commit e83d4a43eb5763545d66a8c81ea3cb9fad4aaef5 parent a5fe8b21cca7b0079ad858f34ccc131af0ce66be Author: Yohanes Bandung <bandungpenting@gmail.com> Date: Mon, 4 May 2020 03:56:26 +0700 refactor: notes, redirect twitter og to listing Diffstat:
| M | layouts/partials/head/twitter-card-metas.html | | | 4 | +++- |
| M | layouts/partials/post/notes-item.html | | | 2 | +- |
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/layouts/partials/head/twitter-card-metas.html b/layouts/partials/head/twitter-card-metas.html @@ -2,8 +2,10 @@ {{ $titleHome := (printf "%s :: %s" .Site.Title .Site.Params.Author) }} {{ $titleRest := (printf "%s :: %s" .Title .Site.Title ) }} {{ $defaultDesc := cond (isset .Site "description") .Description (printf "%s by %s" .Site.Params.Description .Site.Params.Author) }} +{{ $dateformat := .Params.Date.Format "2006-01-02 15:04" }} +{{ $idslug := (print "date-" $dateformat "-") | urlize }} <meta name="twitter:title" content="{{ cond .IsHome $titleHome $titleRest }}"> -<meta name="twitter:url" content="{{ .Permalink }}"> +<meta name="twitter:url" content="{{ cond (eq .Type "notes") ( (print .Site.BaseURL "notes#" $idslug)) .Permalink }}"> <meta name="twitter:description" content="{{ cond .IsHome .Site.Params.Description (.Params.Twitter.Description | default $defaultDesc) }}"> <meta name="twitter:image" content="{{ .Params.Twitter.Image | (cond (isset .Params.Image "src") (printf "%s%s" .Permalink .Params.Image.Src) nil) | default "logo.png" | absURL }}"> <meta name="twitter:site" content="@{{ .Params.Twitter.Site | default .Site.Params.twitter }}"> diff --git a/layouts/partials/post/notes-item.html b/layouts/partials/post/notes-item.html @@ -20,7 +20,7 @@ </time> {{ if .Title }} {{ else }} - <a class="u-url" href="/notes/#{{ $idslug }}">#</a></span> + <a class="u-url" href="/notes/#{{ $idslug }}">#</a> <a href={{ .Permalink }}>ยป</a> {{ end }} </span> {{ with .Title}}