aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorJefferson Julio <[email protected]>2021-05-30 20:06:28 -0300
committerJefferson Julio <[email protected]>2021-05-30 20:06:28 -0300
commite9c35a9eff9e0881df7d6a6e8d17b70ac37ad0fe (patch)
tree2a6a9d105b68daea1094e5a2faaca0fb9b138ab3 /pages
parent1d628ce8cee397ca9c2a8a27d5820c91812a27ca (diff)
downloadblog.sh-e9c35a9eff9e0881df7d6a6e8d17b70ac37ad0fe.tar.bz2
blog.sh-e9c35a9eff9e0881df7d6a6e8d17b70ac37ad0fe.zip
Better modularization
Diffstat (limited to 'pages')
-rwxr-xr-xpages/article.sh21
-rwxr-xr-x[-rw-r--r--]pages/contato.sh23
-rwxr-xr-xpages/home.sh29
3 files changed, 41 insertions, 32 deletions
diff --git a/pages/article.sh b/pages/article.sh
index 9832a76..b50d922 100755
--- a/pages/article.sh
+++ b/pages/article.sh
@@ -1,26 +1,11 @@
#!/bin/bash
-ARTICLE_TITLE=$(basename "$ARTICLE_FILE")
-
-# Pick all file content
-ARTICLE_FILE_CONTENT=$(cat "$ARTICLE_FILE")
-
-# The first 3 lines of the file are metadata information
-ARTICLE_METADATA=$(echo "$ARTICLE_FILE_CONTENT" | head -n 3)
-
-# Skip file metadata, first 3 lines
-ARTICLE_CONTENT=$(echo "$ARTICLE_FILE_CONTENT" | tail -n +3)
-
-# Tags are placed on the first line of the file, delimited by commas
-IFS=',' read -ra ARTICLE_TAGS <<< "$(echo "$ARTICLE_METADATA" | head -n 1)"
-
-ARTICLE_TIME=$(stat --format="Criado em: %w<br/>Última atualização: %z" "$ARTICLE_FILE")
-ARTICLE_BYTES=$(stat --format="%o bytes" "$ARTICLE_FILE")
+source $SCRIPT_DIR/utils/parse-article.sh
if [ $? -gt 0 ]; then
STATUS=404
cat <<ERR
-<p class="err-404">cat: $ARTICLE_FILE: Arquivo ou diretório inexistente</p>
+<p class="err-404">404: $ARTICLE_FILE: Arquivo ou diretório inexistente</p>
ERR
exit 0
fi
@@ -29,7 +14,7 @@ cat <<ARTICLE
<article class="container">
<section>
<div class="post-header">
- <h4 class="post-title">stat -c "%o %w %z" $ARTICLE_FILE</h4>
+ <h4 class="post-title">$ stat -c "%s %w %z" \\ <br/> &gt;&ensp;$ARTICLE_FILE</h4>
<small>$ARTICLE_BYTES</small> <br/>
<time>$ARTICLE_TIME</time> <br/>
diff --git a/pages/contato.sh b/pages/contato.sh
index 74d1ad4..b54a64e 100644..100755
--- a/pages/contato.sh
+++ b/pages/contato.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+
cat <<PAGE
<style>
@media screen and (max-width: 600px) {
@@ -9,5 +10,27 @@ cat <<PAGE
</style>
<article class="contato-page container">
+ <section>
+ <h1>Formas de contato</h1>
+
+ <p>
+ Primeiramente, muito obrigado pelo interesse em me contatar! Você pode ver abaixo minhas
+ informações de contato, pode me chamar a qualquer hora, mas só respondo em horário
+ comercial. Se for algo urgente, escreva "URGENTE" sem aspas no título da mensagem
+ que tentarei fazer de tudo para atendê-lo o quanto antes.
+ </p>
+ </section>
+
+ <section>
+ <address>
+ Email: <a href="mailto:[email protected]">[email protected]</a> <br />
+ Linkedin:
+ <a href="https://www.linkedin.com/in/jefferson-j%C3%BAlio-56a30b149">
+ https://www.linkedin.com/in/jefferson-j%C3%BAlio-56a30b149
+ </a>
+ </address>
+ </section>
</article>
PAGE
+
+# Celular e Whatsapp: +55 (81) 97326-9793 <br />
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 <<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>
+welcome () {
+ cat <<WELCOME
+<section class="conainer" id="welcome">
+ <header>
+ <h1>Bem-vindo ao meu blog :3</h1>
+ <h4>Aqui mostro o meu trabalho e escrevo sobre programação.</h4>
+ </header>
</section>
-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 <<PAGE
<article class="home-feed container">
+ $(welcome)
$(print-all-articles)
</article>
PAGE