diff options
author | Vincent Tam <sere@live.hk> | 2019-08-01 14:33:09 +0300 |
---|---|---|
committer | Vincent Tam <sere@live.hk> | 2019-08-01 14:33:09 +0300 |
commit | 292db09ad9a8207f169456c1d418527a1f9f046e (patch) | |
tree | 178a33afdd307c3bfd158d3a23e2206cfb27841f | |
parent | f24d1d000e91c7cfff55f3158ba73fd54463b0c1 (diff) |
Refactor Page param "song"
- before: manual addition of markdown syntax for links `[title](url)` is
error-prone
- after: utilise Hugo and YAML's capacities to store and parse data
-rw-r--r-- | README.md | 48 | ||||
-rw-r--r-- | layouts/_default/single.html | 2 |
2 files changed, 32 insertions, 18 deletions
@@ -1,34 +1,48 @@ # Huginn -Huginn is a minimalist and responsive theme for [Hugo static site generator](https://gohugo.io). It was once developed for [Pelican](https://getpelican.com) based on the work of **iKevinY** with his theme [pneumatic](https://github.com/iKevinY/pneumatic). +Huginn is a minimalist and responsive theme for [Hugo static site +generator](https://gohugo.io). It was once developed for +[Pelican](https://getpelican.com) based on the work of **iKevinY** with his +theme [pneumatic](https://github.com/iKevinY/pneumatic). -The theme is mainly tailored for my needs but I will try to make it more stateless in order to be used without any fuss by others. +The theme is mainly tailored for my needs but I will try to make it more +stateless in order to be used without any fuss by others. As of today **Huginn** supports : - - Responsive design (using *media queries*) - - Lovely light colors (and dark syntax highlights) took from [snow.vim](https://github.com/nightsense/snow) - - Hugo builtin functions such as +- Responsive design (using *media queries*) +- Lovely light colors (and dark syntax highlights) taken from +[snow.vim](https://github.com/nightsense/snow) +- Hugo builtin functions such as - Table of Content (automatically added if your post contains *headers*) - Related Content - - Rss feeds (tweaked layout to allow full-text rendering) - - JavaScript lightbox powered by [baguetteBox.js](https://github.com/feimosi/baguetteBox.js) - - A `lightbox` shortcode for simple one-image display - - A `gallery` partial to display a nice gallery at the end of your post - - Displaying a link and the name of a song you were listening at while writing a post (activated in front-matter with `song: [title](link)`) - - Comments powered by [Isso](https://posativ.org/isso/) for - now. A parameter in `config.yaml` is used to specify Isso server - `{{ .Site.Params.isso_server }}` - - Static comments powered by [Staticman](https://staticman.net) v3. See the - instructions below to get the service started. + - RSS feeds (tweaked layout to allow full-text rendering) +- JavaScript lightbox powered by +[baguetteBox.js](https://github.com/feimosi/baguetteBox.js) +- A `lightbox` shortcode for simple one-image display +- A `gallery` partial to display a nice gallery at the end of your post +- Display the link and the name of the song that you were listening to while +writing a post (activated in front-matter with the `song` section). + + ```yaml + song: + title: Song title + link: https://example.com + ``` + +- Comments powered by [Isso](https://posativ.org/isso/) for now. A parameter in +`config.toml` is used to specify Isso server `{{ .Site.Params.isso_server }}`. +- Static comments powered by [Staticman](https://staticman.net) v3. See the +[instructions below](#staticman) to get the service started. ## Lightbox -> This shortcode uses the **Page Bundle** function introduced in Hugo 0.32, make sure to be aware of it when playing with `lightbox`. +> This shortcode uses the **Page Bundle** function introduced in Hugo 0.32, make +sure to be aware of it when playing with `lightbox`. The `lightbox` shortcode is pretty simple and looks like this: -``` +```go-html {{ $img := (.Page.Resources.ByType "image").GetMatch ( printf "images/lightbox/%s*" (.Get "img")) }} {{ $align := (.Get "align") }} {{ .Scratch.Set "image" ($img.Resize "256x q80") }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3e81f1b..9e03cf3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -43,7 +43,7 @@ </header> {{ with .Params.song -}} <div class='nowlistening'> - {{ i18n "song" }} {{ . | markdownify -}} + {{ i18n "song" }} <a href='{{ .link }}'>{{ .title }}</a> </div> {{ end -}} {{ if .TableOfContents -}} |