changeset:   31:3e14943901dc
branch:      nailim
tag:         tip
user:        web@RpiOne
date:        Mon Jun 26 13:04:27 2023 +0200
summary:     Modify rss feed generator to generate correct pubDate for each individual post
diff -r bfe8a8115155 lib/rss
--- a/lib/rss	Sat May 13 20:40:38 2023 +0200
+++ b/lib/rss	Mon Jun 26 12:58:14 2023 +0200
@@ -11,14 +11,20 @@
 	ndate -m `{date `{mtime $barf_root/$"barf_dir/src | awk '{print $1}'}}	# rfc2822 last time channel content changed.
 	echo -n ''
 	echo 'en-us'
-	date=`{ndate -m}	# rfc2822 publication date for content in the channel.
 	get_post_list
 	for(i in `{seq 1 $#posts}){
 		a_id=$posts($i)
 		a_dir=$barf_root/$"barf_dir/src/$a_id
 		echo '- '
 		echo ''$base_url^$barf_base_uri'?id='$"a_id''
-		echo ''$"date''
+		# rfc2822 publication date for individual content piece in the channel.
+		if (test -f $a_dir/date) {
+			pubdate=`{ndate -m `{cat $a_dir/date}}
+		}
+		if not {
+			pubdate=`{ndate -m `{date `{mtime $a_dir | awk '{print $1}'}}}
+		}
+		echo ''$"pubdate''
 		title=`{cat $a_dir/title}
 		if(~ $title '')
 			ntitle=($siteTitle $"a_id)