aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-09-27 17:18:30 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-09-27 17:18:30 +0200
commit5adb19d54b652b46f1b2b853e5221a0afe4fcc16 (patch)
treef196da1ec2265ee35e6fd97fbcd7e5c6d5cfc193
parent58bb8195ef341265c957254606694e0799252995 (diff)
downloadrgoncalves.se-5adb19d54b652b46f1b2b853e5221a0afe4fcc16.tar.gz
rssg: Add rss generation support
-rw-r--r--Makefile1
-rw-r--r--bin/func13
-rwxr-xr-xbin/ssg5
3 files changed, 15 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 02cb358..97be6f5 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ all: clean website
website: clean
./bin/ssg
+ ./bin/rssg
deploy: website
rsync -e ssh -avz --delete ./out/ $(REMOTE):$(REMOTE_DIR)
diff --git a/bin/func b/bin/func
index af81d92..eb3b489 100644
--- a/bin/func
+++ b/bin/func
@@ -6,6 +6,12 @@ tmp_dir="tmp"
out_dir="out"
tmp_file="${tmp_dir}/tmp"
+rss_dir="${src_dir}/b"
+rss_out_file="${out_dir}/rss.xml"
+
+website_title="rgoncalves.se"
+website_link="https://${website_title}"
+website_description="hacker and "
__get_value() {
# 1: filename
@@ -50,6 +56,13 @@ __get_value_date_human() {
__get_value_date "${1}" | xargs date -j -f "%Y-%m-%d" +"%B %d, %Y"
}
+__get_value_date_publication() {
+ # 1: filename
+ # Get publication date according to rfc 2822 and return a safe string.
+ __get_value_date "${1}" |
+ xargs date -j -f "%Y-%m-%d" +"%a, %d %b %Y %H:%M:%S %z"
+}
+
__get_out_filename() {
# 1: filename
# Convert the source filename to its output destination.
diff --git a/bin/ssg b/bin/ssg
index d3f2e02..3af40a2 100755
--- a/bin/ssg
+++ b/bin/ssg
@@ -1,12 +1,9 @@
#!/bin/sh
-. $(dirname "${0}")/func
+. bin/func
set -xe
-# Check if the working directory is valid.
-echo "${0}" | grep '^./bin/ssg$'
-
src_files="$(__list_files ${src_dir})"
dirs="${media_dir} \
${src_dir} \
remember that computers suck.