Add footer support for gemini

This commit is contained in:
Erick Ruiz de Chavez 2024-12-21 19:47:20 -05:00
parent c13d147ac6
commit 2238a863e3
4 changed files with 13 additions and 0 deletions

3
_includes/footer.gmi Normal file
View file

@ -0,0 +1,3 @@
© %%year%% Erick Ruiz de Chavez

View file

@ -3,3 +3,4 @@
## %%title%% ## %%title%%
%%body%% %%body%%
%%links%% %%links%%
%%footer%%

View file

@ -3,3 +3,4 @@
%%articles%% %%articles%%
%%drafts%% %%drafts%%
%%links%% %%links%%
%%footer%%

View file

@ -4,7 +4,9 @@ mkdir -p _capsule
articles_list="" articles_list=""
current_year=$(date +%Y)
header_body=$(cat _includes/header.gmi) header_body=$(cat _includes/header.gmi)
footer_body=$(cat _includes/footer.gmi)
links_body=$(cat _includes/links.gmi) links_body=$(cat _includes/links.gmi)
for post in $(ls _posts/*.md); do for post in $(ls _posts/*.md); do
@ -23,6 +25,8 @@ for post in $(ls _posts/*.md); do
| perl -pe "s|%%links%%|${links_body}|" \ | perl -pe "s|%%links%%|${links_body}|" \
| perl -pe "s|%%title%%|${article_title}\n${article_date}\n|" \ | perl -pe "s|%%title%%|${article_title}\n${article_date}\n|" \
| perl -pe "s|%%body%%|${article_body}|" \ | perl -pe "s|%%body%%|${article_body}|" \
| perl -pe "s|%%footer%%|${footer_body}|" \
| perl -pe "s|%%year%%|${current_year}|" \
> $gemfile > $gemfile
articles_list="$articles_list=> ${gemfile/_capsule\//} $article_date $article_title\n" articles_list="$articles_list=> ${gemfile/_capsule\//} $article_date $article_title\n"
@ -46,6 +50,8 @@ if [ "${GEMINI_ENV}" != 'production' ]; then
| perl -pe "s|%%links%%|${links_body}|" \ | perl -pe "s|%%links%%|${links_body}|" \
| perl -pe "s|%%title%%|${article_title}|" \ | perl -pe "s|%%title%%|${article_title}|" \
| perl -pe "s|%%body%%|${article_body}|" \ | perl -pe "s|%%body%%|${article_body}|" \
| perl -pe "s|%%footer%%|${footer_body}|" \
| perl -pe "s|%%year%%|${current_year}|" \
> $gemfile > $gemfile
drafts_list="$drafts_list=> ${gemfile/_capsule\//} $article_title\n" drafts_list="$drafts_list=> ${gemfile/_capsule\//} $article_title\n"
@ -72,6 +78,8 @@ cat _layouts/home.gmi \
| perl -pe "s|%%body%%|${index_body}|" \ | perl -pe "s|%%body%%|${index_body}|" \
| perl -pe "s|%%articles%%|${articles}|" \ | perl -pe "s|%%articles%%|${articles}|" \
| perl -pe "s|%%drafts%%|${drafts}|" \ | perl -pe "s|%%drafts%%|${drafts}|" \
| perl -pe "s|%%footer%%|${footer_body}|" \
| perl -pe "s|%%year%%|${current_year}|" \
> _capsule/index.gmi > _capsule/index.gmi
echo "Done" echo "Done"