From e9c35a9eff9e0881df7d6a6e8d17b70ac37ad0fe Mon Sep 17 00:00:00 2001 From: Jefferson Julio Date: Sun, 30 May 2021 20:06:28 -0300 Subject: Better modularization --- pages/home.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'pages/home.sh') diff --git a/pages/home.sh b/pages/home.sh index ebb399d..c9a9966 100755 --- a/pages/home.sh +++ b/pages/home.sh @@ -1,25 +1,26 @@ #!/bin/bash -print-all-articles () { - for i in $(find ./pages/articles -type f -name '*.txt'); do - ARTICLE_CONTENT=$(tail -n +3 $i) - cat < -
-
stat -c "%w %z" $i
- -
- -

$(echo "$ARTICLE_CONTENT" | head -c 120)...

- - Ler artigo completo +welcome () { + cat < +
+

Bem-vindo ao meu blog :3

+

Aqui mostro o meu trabalho e escrevo sobre programação.

+
-POST +WELCOME +} + +print-all-articles () { + # Find all articles and sort by date of creation + for i in $(find $ARTICLES_PATH -type f -name '*.txt' -printf "%T@ %p\n" | sort -rn | cut -b 23-); do + ARTICLE_FILE="${i/* /}" source $SCRIPT_DIR/components/post-preview.sh done } cat < + $(welcome) $(print-all-articles) PAGE -- cgit v1.2.3