aboutsummaryrefslogtreecommitdiff
path: root/pages/home.sh
blob: c9a99669bdf96a29fce5dcf75e2115cacdd3758a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

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>
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