hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit 63aba1276de820a1f5e78aed67ebb38c896fcd41
parent 325cdb419759ed4dd1116d446fe05ac0851532d4
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Fri,  5 Aug 2016 14:20:07 -0400

Add a better permalink.

Diffstat:
Mfunctions/create-html-pages.sh | 7+++++--
Mtemplates/mustache/note-index.inc.mustache | 6+++---
Mtemplates/mustache/note.mustache | 6+++++-
3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/functions/create-html-pages.sh b/functions/create-html-pages.sh @@ -32,18 +32,21 @@ create_html_pages () { mkdir -p $(dirname "$markdown")/$year/$month fi + pagepath=$year/$month/${outputname%.*} + # Check if a section have a specific template or use the default template if [[ " ${templates[*]} " == *" $section "* ]]; then # Check if the date property value is not "null" if [[ "$config_date" != "null" ]]; then - pandoc -s $markdown --template=$TPL_PANDOC_PATH/${section}.html --variable=modified:$(date -r $markdown +%Y-%m-%dT%H:%M:%S) -o $(dirname "$markdown")/$year/$month/${outputname%.*}.html + + pandoc -s $markdown --template=$TPL_PANDOC_PATH/${section}.html --variable=modified:$(date -r $markdown +%Y-%m-%dT%H:%M:%S) --variable=permalink:$BASE_URL/$section/$pagepath.html -o $(dirname "$markdown")/$pagepath.html else pandoc -s $markdown --template=$TPL_PANDOC_PATH/${section}.html -o $(dirname "$markdown")/${outputname%.*}.html fi else if [[ "$config_date" != "null" ]]; then - pandoc -s $markdown --template=$TPL_PANDOC_PATH/default.html --variable=modified:$(date -r $markdown +%Y-%m-%dT%H:%M:%S) -o $(dirname "$markdown")/$year/$month/${outputname%.*}.html + pandoc -s $markdown --template=$TPL_PANDOC_PATH/default.html --variable=modified:$(date -r $markdown +%Y-%m-%dT%H:%M:%S) --variable=permalink:$BASE_URL/$section/$pagepath.html -o $(dirname "$markdown")/$pagepath.html else pandoc -s $markdown --template=$TPL_PANDOC_PATH/default.html -o $(dirname "$markdown")/${outputname%.*}.html fi diff --git a/templates/mustache/note-index.inc.mustache b/templates/mustache/note-index.inc.mustache @@ -5,10 +5,10 @@ $if(cite)$ <footer class="note__blockquote__footer"> &mdash; - <cite class="note__blockquote__cite"> + <cite class="note__blockquote__cite"> <a href="$citeurl$" rel="external nofollow"> $cite$ - </a> + </a> </cite> </footer> $endif$ @@ -24,7 +24,7 @@ $if(url)$ href="$url$" $endif$ - rel="permalink syndication"> + rel="syndication"> <time class="dt-published dt-updated" $if(datetime)$datetime="$date$T$datetime$"$endif$>$date$</time> </a> par <em class="p-author author">{{ SITE_AUTHOR }}</em> diff --git a/templates/mustache/note.mustache b/templates/mustache/note.mustache @@ -27,8 +27,12 @@ $endif$ <footer class="note__footer"> + $if(permalink)$ <a class="note__link u-url u-uid u-syndication bookmark" - href="#">#</a> + href="$permalink$" + rel="bookmark">#</a> + $endif$ + Publié le <time class="dt-published" $if(datetime)$datetime="$date$T$datetime$"$endif$>$date$</time> par <a class="p-author author" href="{{ SITE_URL }}#hs" rel="author"><i>{{ SITE_AUTHOR }}</i></a>. $if(modified)$Modifié le <time class="dt-updated">$modified$</time>.$endif$