From c5ad7625aaaf32ba407729aa63b3d48edb5eb910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Wed, 15 May 2024 12:51:49 +0200 Subject: feat: init static site generator --- rssg | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 rssg (limited to 'rssg') diff --git a/rssg b/rssg new file mode 100755 index 0000000..16fdd2b --- /dev/null +++ b/rssg @@ -0,0 +1,48 @@ +#!/bin/sh + +. "$(dirname "${0}")/functions.sh" + +set -e + +current_date=$(date +"%a, %d %b %Y %H:%M:%S %z") + +cat <<-EOF > "${rss_out_file}" + + +${website_title} +${website_description} +${website_link} +$(date +"%Y") ${website_title} - All rights reserved +${website_email} +${website_email} +${current_date} +${current_date} +${website_generator} +${website_language} +https://validator.w3.org/feed/docs/rss2.html +1800 +EOF + +for file in $(__list_files_date "${rss_dir}"); do + __get_value "${file}" "draft" >/dev/null && continue + + title=$(__get_value_title "${file}") + date=$(__get_value_date_publication "${file}") + link="${website_link}/$(__get_final_filename "${file}")" + guid="$(echo "${link}" | "${__sha256}" | cut -d ' ' -f 1)" + description=$(__generate_rss_body "${file}") + cat <<-EOF >> "${rss_out_file}" + + ${title} + ${link} + ${date} + ${guid} + ${description} + + EOF +done + +cat <<-EOF >> "${rss_out_file}" + + +EOF -- cgit v1.2.3