extract header and footer into functions
This commit is contained in:
parent
8a7a6dbb4c
commit
8673ca1601
|
@ -4,6 +4,16 @@ output() {
|
||||||
echo "$1" >> index.html
|
echo "$1" >> index.html
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_header() {
|
||||||
|
output '<h1>Blog index</h1>'
|
||||||
|
output '<table id="linklist">'
|
||||||
|
}
|
||||||
|
|
||||||
|
add_footer() {
|
||||||
|
html_entry "legacy" "before 2020" "Older posts"
|
||||||
|
output '</table>'
|
||||||
|
}
|
||||||
|
|
||||||
html_entry() {
|
html_entry() {
|
||||||
output '<tr>'
|
output '<tr>'
|
||||||
path="$1"
|
path="$1"
|
||||||
|
@ -38,12 +48,9 @@ cd /home/nginx/html/blog
|
||||||
if has_updates; then
|
if has_updates; then
|
||||||
git pull &> /dev/null
|
git pull &> /dev/null
|
||||||
rm -f index.html
|
rm -f index.html
|
||||||
output '<h1>Blog index</h1>'
|
add_header
|
||||||
output '<table id="linklist">'
|
|
||||||
ls -ltu src/*.md | tail -n+1 | while read f; do create_entry $f; done
|
ls -ltu src/*.md | tail -n+1 | while read f; do create_entry $f; done
|
||||||
html_entry "legacy" "before 2020" "Older posts"
|
add_footer
|
||||||
output '</table>'
|
|
||||||
output "<footer><a href=\"https://kageru.moe/contact/\">Contact</a><br/>last updated on $(date '+%d.%m.%y at %H:%M:%S')</footer>"
|
|
||||||
# Human-readable output for the cron notification
|
# Human-readable output for the cron notification
|
||||||
echo 'Updated blog to:'
|
echo 'Updated blog to:'
|
||||||
git log -1
|
git log -1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user