diff options
author | Telérico Jones <[email protected]> | 2021-05-29 21:09:08 -0300 |
---|---|---|
committer | Telérico Jones <[email protected]> | 2021-05-29 21:09:08 -0300 |
commit | cade848b78d7f06b69a195f5a543b23c25eedd14 (patch) | |
tree | 6f6b4f766a58ccd61452da7a32830f051a89003e /pages/home.sh | |
download | blog.sh-cade848b78d7f06b69a195f5a543b23c25eedd14.tar.bz2 blog.sh-cade848b78d7f06b69a195f5a543b23c25eedd14.zip |
blog.sh project start
Diffstat (limited to 'pages/home.sh')
-rwxr-xr-x | pages/home.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pages/home.sh b/pages/home.sh new file mode 100755 index 0000000..ebb399d --- /dev/null +++ b/pages/home.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +print-all-articles () { + for i in $(find ./pages/articles -type f -name '*.txt'); do + ARTICLE_CONTENT=$(tail -n +3 $i) + cat <<POST +<section class="post-preview"> + <div class="post-header-preview"> + <h5 class="post-title">stat -c "%w %z" $i</h5> + <time>$(stat --format="Criado em: %w<br/>Última atualização: %z" $i)</time> + </div> + + <p>$(echo "$ARTICLE_CONTENT" | head -c 120)...</p> + + <a href="/artigo/$(basename $i)">Ler artigo completo</a> +</section> +POST + done +} + +cat <<PAGE +<article class="home-feed container"> + $(print-all-articles) +</article> +PAGE |