diff --git a/engine/mk-index.sh b/engine/mk-index.sh
index d6cc7db..d424cf9 100755
--- a/engine/mk-index.sh
+++ b/engine/mk-index.sh
@@ -6,17 +6,8 @@ webdir="_site"
postsdir="$webdir/posts"
indexfile="$webdir/index.html"
-# maximal number of articles to put in the RSS file
-maxarticles=100
-
-# RSS Metas
-rsstitle="her.esy.fun"
-rssurl="https://her.esy.fun/rss.xml"
-websiteurl="https://her.esy.fun"
-rssdescription="her.esy.fun articles, mostly random personal thoughts"
-rsslang="en"
-rssauthor="yann@esposito.host (Yann Esposito)"
-rssimgurl="https://her.esy.fun/img/FlatAvatar.png"
+# maximal number of articles to put in the index homepage
+maxarticles=1000
# HTML Accessors (similar to CSS accessors)
dateaccessor='.yyydate'
@@ -31,7 +22,6 @@ formatdate() {
# echo "DEBUG DATE: $d" >&2
LC_TIME=en_US date --date $d +'%a, %d %b %Y %H:%M:%S %z'
}
-
finddate(){ < $1 hxselect -c $dateaccessor | sed 's/\[//g;s/\]//g;s/ .*$//' }
findtitle(){ < $1 hxselect -c $titleaccessor }
getcontent(){
@@ -45,7 +35,6 @@ mkcategories(){
}
autoload -U colors && colors
-
tmpdir=$(mktemp -d)
typeset -a dates
dates=( )
@@ -66,7 +55,6 @@ for fic in $postsdir/**/*.html; do
keywords=( $(findkeywords $xfic) )
printf ": %-55s" "$title ($keywords)"
categories=$(mkcategories $keywords)
- absoluteurl="${websiteurl}/${blogfile}"
{ printf "\\n
"
printf "\\n%s " "${blogfile}" "$title"
printf "\\n%s %s" "$d"
@@ -76,84 +64,84 @@ for fic in $postsdir/**/*.html; do
dates=( $d $dates )
echo " [${fg[green]}OK${reset_color}]"
done
+
echo "Publishing"
+
+# building the body
+
+{ cat <
+Home |
+Slides |
+About
+
+(code
+bookmarks
+notes )
+
+
+EOF
+} >> $tmpdir/index
+
+previousyear=""
for fic in $(ls $tmpdir/*.index | sort -r | head -n $maxarticles ); do
echo "${fic:t}"
+ year=$( echo "${fic:t}" | perl -pe 's#(\d{4})-.*#$1#')
+ if (( year != previousyear )); then
+ echo $year
+ if (( previousyear > 0 )); then
+ echo "" >> $tmpdir/index
+ fi
+ previousyear=$year
+ echo "${year} " >> $tmpdir/index
+ fi
cat $fic >> $tmpdir/index
done
+{ cat <
+Archive of old articles (2008-2016)
+Most popular:
+
+EOF
+} >> $tmpdir/index
-rssmaxdate=$(formatdate $(for d in $dates; do echo $d; done | sort -r | head -n 1))
-rssbuilddate=$(formatdate $(date))
-title="Index"
-description="Index of latest posts."
+title="Yann Esposito's Posts"
+description="The index of my most recent articles."
author="Yann Esposito"
+body=$(< $tmpdir/index)
+date=$(LC_TIME=en_US date +'%Y-%m-%d')
+# the pandoc templates use $x$ format, we replace it by just $x
+# to be used with envsubst
+template=$(< templates/post.html | perl -pe 's#(\$[^\$]*)\$#$1#g' )
{
-cat <
-
-
-
-
- $title
-
-
-
-
-
-
-
-
-
-
-
$title
-
-
- $description
-
-
-
-
-
-
-
-
-END
+ export title
+ export author
+ export description
+ export date
+ export body
+ echo ${template} | envsubst
} > "$indexfile"
rm -rf $tmpdir
diff --git a/templates/post.html b/templates/post.html
index e87c056..ca70bee 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -23,6 +23,7 @@
+