blob: 02adf53261e1e62b5f4e188ead8f10d28d1f4e16 (
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
27
28
29
30
31
32
33
34
35
36
37
|
#!/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
IFS=';' read -ra ARTICLE_LIST <<< "$(
find $ARTICLES_PATH \
-type f \
-name '*.txt' \
-printf "%T@ %p\n" |
sort -rn |
cut -b 23- |
sed 's/^ //g' |
tr '\n' ';'
)"
for i in "${ARTICLE_LIST[@]}"; 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
|