diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 59cb12c..8c4dea2 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -17,6 +17,17 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version +== [Unreleased] + +=== Fixed + +* Make a few tweaks with CSS. +* Formatting of files. +* Relative files in the contact links are now linked with `absLangURL` which is useful for linking web feeds. + + + + == [0.1.2] - 2020-11-04 === Fixed diff --git a/README.adoc b/README.adoc index 154e4d5..2e08ef2 100644 --- a/README.adoc +++ b/README.adoc @@ -143,7 +143,7 @@ paginate = 20 [module] [[module.imports]] - path = "github.com/foo-dogsquared/hugo-theme-contentful" + path = "github.com/foo-dogsquared/hugo-theme-more-contentful" [[module.imports]] path = "github.com/foo-dogsquared/hugo-web-feeds" diff --git a/assets/css/prism.css b/assets/css/prism.css index 8b2a7f1..81b7bc3 100644 --- a/assets/css/prism.css +++ b/assets/css/prism.css @@ -1,13 +1,11 @@ /** - * Dracula Theme originally by Zeno Rocha [@zenorocha] - * https://draculatheme.com/ - * - * Ported for PrismJS by Albert Vallverdu [@byverdu] + * This is a CSS stylesheet template for Prism in case you use that. + * This is based from a Prism CSS port by Albert Vallverdu [@byverdu]. */ code[class*="language-"], pre[class*="language-"] { - color: var(--base07); + color: var(--base05); background: none; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; text-align: left; diff --git a/assets/scss/base.scss b/assets/scss/base.scss index 7993755..871b585 100644 --- a/assets/scss/base.scss +++ b/assets/scss/base.scss @@ -59,7 +59,7 @@ a { } dd, li, p, td { - line-height: 1.5; + line-height: 1.45; } p { diff --git a/assets/scss/layout.scss b/assets/scss/layout.scss index e3ec343..8f940eb 100644 --- a/assets/scss/layout.scss +++ b/assets/scss/layout.scss @@ -1,10 +1,3 @@ -@for $i from 0 through 15 { - $hex: decToHex($i); - .base#{$hex} { - color: var(--base#{$hex}); - } -} - .list { display: inline-flex; flex-flow: row wrap; diff --git a/assets/scss/main.scss b/assets/scss/main.scss index e83b6be..e96b237 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -30,12 +30,6 @@ @return str-slice($hex, $first, $first) + str-slice($hex, $second, $second) } -@mixin content-separator { - content: " | "; - color: var(--base03); - margin: auto 0.5em; -} - @mixin header-link-hover-style { > *:hover { color: var(--base0C); diff --git a/config.toml b/config.toml index 555fa6a..fcaab0b 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,8 @@ [module] + [module.hugoVersion] + extended = true + min = "0.74.0" + [[module.imports]] path = "github.com/foo-dogsquared/hugo-theme-contentful" [[module.imports]] diff --git a/layouts/_default/list.html b/layouts/_default/list.html index d8213e3..83f9ef8 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -6,13 +6,13 @@ Otherwise, we take the pages of a section. */ -}} {{- $pages := .Pages }} {{- if .IsHome }} -{{- $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }} + {{- $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }} {{- end }} {{- range (where (.Paginate $pages).Pages "Params.hidden" "!=" true) }} <article class="post"> - <h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1> - {{ partial "partials/components/post-meta.html" . }} + <h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1> + {{ partial "partials/components/post-meta.html" . }} </article> {{- end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0c1c9c0..54b741a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,58 +1,58 @@ {{ define "main" }} <article class="post--single"> - <header> - <h1>{{ .Title }}</h1> - </header> - {{ partial "partials/components/post-meta.html" . }} + <header> + <h1>{{ .Title }}</h1> + </header> + {{ partial "partials/components/post-meta.html" . }} - {{ $is_toc := cond (ne .Params.toc nil) .Params.toc $.Site.Params.toc }} - {{ if (and $is_toc (gt (countrunes .TableOfContents) 0)) }} - <style> - #TableOfContents:not(:empty)::before { - content: "{{ i18n "table_of_contents" }}"; - font-weight: bold; - } - </style> - {{ .TableOfContents }} -{{ end }} + {{ $is_toc := cond (ne .Params.toc nil) .Params.toc $.Site.Params.toc }} + {{ if (and $is_toc (gt (countrunes .TableOfContents) 0)) }} + <style> +#TableOfContents:not(:empty)::before { + content: "{{ i18n "table_of_contents" }}"; + font-weight: bold; +} + </style> + {{ .TableOfContents }} + {{ end }} - <main> + <main> {{ .Content }} - </main> + </main> - <hr> - <div class="post__meta--single"> - <!-- List the author(s) of the article. --> - {{- with .Params.author }} - {{- $names := slice }} - {{- range . }}{{ $names = $names | append .name }}{{ end }} - <p data-content-author="{{ jsonify $names }}">{{ i18n "published_by" }}: {{ delimit $names ", " (printf " %s " (i18n "and")) }}</p> - {{- end }} + <hr> + <div class="post__meta--single"> + <!-- List the author(s) of the article. --> + {{- with .Params.author }} + {{- $names := slice }} + {{- range . }}{{ $names = $names | append .name }}{{ end }} + <p data-content-author="{{ jsonify $names }}">{{ i18n "published_by" }}: {{ delimit $names ", " (printf " %s " (i18n "and")) }}</p> + {{- end }} - <!-- Only show the creation date if the `date` field is valid. --> - {{- if ne (.Date.Format "2006") "0001" -}} - <!-- Publication date. --> - <p data-content-publication-date="{{ .Date }}">{{ i18n "published_on" }}: <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time></p> - {{- end }} + <!-- Only show the creation date if the `date` field is valid. --> + {{- if ne (.PublishDate.Format "2006") "0001" -}} + <!-- Publication date. --> + <p data-content-publication-date="{{ .Date }}">{{ i18n "published_on" }}: <time datetime="{{ .PublishDate.Format "2006-01-02" }}">{{ .PublishDate.Format "2006-01-02" }}</time></p> + {{- end }} - <!-- Modification date (will only appear if the publication date is less than the modified date.) --> - {{- if ne .Date .Lastmod }} - <p data-content-modification-date="{{ .Lastmod }}">{{ i18n "updated_on" }}: <time datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</time></p> - {{- end }} + <!-- Modification date (will only appear if the publication date is less than the modified date.) --> + {{- if ne .Date .Lastmod }} + <p data-content-modification-date="{{ .Lastmod }}">{{ i18n "updated_on" }}: <time datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</time></p> + {{- end }} - <!-- Link the translated versions if the article has at least one translated page. --> - {{- if .IsTranslated }} - {{- $lang_links := slice }} - {{- $langs := slice }} - {{- range .Translations }} - {{- $lang := cond (ne .Language.LanguageName nil) .Language.LanguageName .Lang }} - {{ $lang_links = $lang_links | append (printf "<a href=%s>%s</a>" .Permalink $lang) }} - {{ $langs = $langs | append $lang }} - {{- end }} - <p data-content-translations="{{ jsonify $langs }}">{{ i18n "available_translations" }}: {{ delimit $lang_links "," (printf " %s " (i18n "and")) }}</p> - {{- end }} - </div> + <!-- Link the translated versions if the article has at least one translated page. --> + {{- if .IsTranslated }} + {{- $lang_links := slice }} + {{- $langs := slice }} + {{- range .Translations }} + {{- $lang := cond (ne .Language.LanguageName nil) .Language.LanguageName .Lang }} + {{ $lang_links = $lang_links | append (printf "<a href=%s>%s</a>" .Permalink $lang) }} + {{ $langs = $langs | append $lang }} + {{- end }} + <p data-content-translations="{{ jsonify $langs }}">{{ i18n "available_translations" }}: {{ delimit $lang_links "," (printf " %s " (i18n "and")) }}</p> + {{- end }} + </div> </article> {{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 96dc508..9c8e189 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -5,12 +5,12 @@ <!-- Linking to other languages' homepage. --> {{ if $.Site.IsMultiLingual }} -<p>{{ i18n "multilingual" }}: -<span class="list site__languages"> -{{ range $.Site.Languages }} - <a href="{{ . | relURL }}" hreflang="{{ .Lang }}">{{ with .LanguageName }}{{ . }}{{ else }}{{ .Lang }}{{ end }}</a> -{{ end }} -</span> + <p>{{ i18n "multilingual" }}: + <span class="list site__languages"> + {{ range $.Site.Languages }} + <a href="{{ . | relURL }}" hreflang="{{ .Lang }}">{{ with .LanguageName }}{{ . }}{{ else }}{{ .Lang }}{{ end }}</a> + {{ end }} + </span> </p> {{ end }} @@ -24,12 +24,12 @@ {{ $links = sort $links "weight" "asc" }} {{- range $links -}} <li> - <a {{ if $useImage }}class="site__social-icon"{{ end }} rel="me" href="{{ .url }}" aria-label="{{ with .name }}{{ . }}{{ else }}{{ .id }}{{ end }}"> - {{- if $useImage }} - {{- partial "components/icon.html" (dict "id" .id "output" "icons/brand/%s.svg" "template" "templates/simple-icon.svg") }} - {{- else }} - {{- .name }} - {{- end }} + <a {{ if $useImage }}class="site__social-icon"{{ end }} rel="me" href="{{ .url | absLangURL }}" aria-label="{{ with .name }}{{ . }}{{ else }}{{ .id }}{{ end }}"> + {{- if $useImage }} + {{- partial "components/icon.html" (dict "id" .id "output" "icons/brand/%s.svg" "template" "templates/simple-icon.svg") }} + {{- else }} + {{- .name }} + {{- end }} </a> </li> {{- end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index c14dba8..d1eb0ea 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -39,22 +39,22 @@ {{- /* Linking all of the output formats for discovery. */ -}} {{- range .OutputFormats }} -{{- printf "<link rel=%q type=%q href=%q />" .Rel .MediaType.Type .Permalink | safeHTML }} + {{- printf "<link rel=%q type=%q href=%q />" .Rel .MediaType.Type .Permalink | safeHTML }} {{- end }} {{- if hugo.IsProduction }} - {{ template "_internal/google_analytics_async.html" . }} - {{ template "_internal/disqus.html" . }} + {{ template "_internal/google_analytics_async.html" . }} + {{ template "_internal/disqus.html" . }} {{- end }} {{- /* Persistent theme. It's a very small script so there's little effect on perceived performance. */ -}} <script> - let theme = window.localStorage.getItem('theme'); - if (theme) { - document.documentElement.dataset.theme = theme; - } + let theme = window.localStorage.getItem('theme'); + if (theme) { + document.documentElement.dataset.theme = theme; + } </script> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index e7bd707..ffef595 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,9 +2,9 @@ <a class="site__title" href="{{ "" | absLangURL }}">{{ $.Site.Title }}</a> <div class="list site__links"> {{ with $.Site.Menus.main }} - {{ range . -}} - <a href="{{ .URL | absLangURL }}">{{- .Name -}}</a> - {{ end }} + {{ range . -}} + <a href="{{ .URL | absLangURL }}">{{- .Name -}}</a> + {{ end }} {{ end }} </div> - </nav> +</nav> diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 88fb348..d94f5df 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -14,52 +14,52 @@ {{- $ellipsed := false -}} {{- $shouldEllipse := false -}} {{- range $pag.Pagers -}} - {{ $minimumActivePage := sub $pag.PageNumber $activeNumberOfPages }} - {{ $maximumActivePage := add $pag.PageNumber $activeNumberOfPages }} + {{ $minimumActivePage := sub $pag.PageNumber $activeNumberOfPages }} + {{ $maximumActivePage := add $pag.PageNumber $activeNumberOfPages }} - {{- /* Make all of the given number of pages starting from both ends to be visible */ -}} - {{- $showNumber := or (le .PageNumber $minimumPage) (lt (sub .TotalPages .PageNumber) $minimumPage) -}} + {{- /* Make all of the given number of pages starting from both ends to be visible */ -}} + {{- $showNumber := or (le .PageNumber $minimumPage) (lt (sub .TotalPages .PageNumber) $minimumPage) -}} - {{- /* Make all of the given number of pages between the active page number visible */ -}} - {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber $midpointPages)) (lt .PageNumber (add $pag.PageNumber $midpointPages))) -}} + {{- /* Make all of the given number of pages between the active page number visible */ -}} + {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber $midpointPages)) (lt .PageNumber (add $pag.PageNumber $midpointPages))) -}} - {{- /* - Make all of the page number that is just before/after the minimum page threshold to be visible. - This is applied to those situations where there's only one number remaining before the end - */ -}} - {{ if eq .PageNumber (sub $minimumActivePage 1) }} - {{ $showNumber = or $showNumber (eq (sub $minimumActivePage $minimumPage) (add $pag.First.PageNumber 1)) }} - {{ else if eq .PageNumber (add $maximumActivePage 1) }} - {{ $showNumber = or $showNumber (eq (add $maximumActivePage 1) (sub $pag.Last.PageNumber $minimumPage)) }} - {{ end }} + {{- /* + Make all of the page number that is just before/after the minimum page threshold to be visible. + This is applied to those situations where there's only one number remaining before the end + */ -}} + {{ if eq .PageNumber (sub $minimumActivePage 1) }} + {{ $showNumber = or $showNumber (eq (sub $minimumActivePage $minimumPage) (add $pag.First.PageNumber 1)) }} + {{ else if eq .PageNumber (add $maximumActivePage 1) }} + {{ $showNumber = or $showNumber (eq (add $maximumActivePage 1) (sub $pag.Last.PageNumber $minimumPage)) }} + {{ end }} - {{- if $showNumber -}} - {{- $ellipsed = false -}} - {{- $shouldEllipse = false -}} - {{- else -}} - {{- $shouldEllipse = not $ellipsed -}} - {{- $ellipsed = true -}} - {{- end -}} - {{- if $showNumber }} - <li> + {{- if $showNumber -}} + {{- $ellipsed = false -}} + {{- $shouldEllipse = false -}} + {{- else -}} + {{- $shouldEllipse = not $ellipsed -}} + {{- $ellipsed = true -}} + {{- end -}} + {{- if $showNumber }} + <li> <a class="page-link{{ if eq . $pag }}--active{{ end }}" href="{{ .URL }}" - {{- if eq (sub $pag.PageNumber .PageNumber) 1 }} - rel="prev" - aria-label="Previous" - {{- else if (eq (sub $pag.PageNumber .PageNumber) -1) }} - rel="next" - aria-label="Next" - {{- else if (eq $pag.PageNumber .PageNumber) }} - aria-label="Current" - aria-current="page" - {{- end -}} + {{- if eq (sub $pag.PageNumber .PageNumber) 1 }} + rel="prev" + aria-label="Previous" + {{- else if (eq (sub $pag.PageNumber .PageNumber) -1) }} + rel="next" + aria-label="Next" + {{- else if (eq $pag.PageNumber .PageNumber) }} + aria-label="Current" + aria-current="page" + {{- end -}} >{{ .PageNumber }}</a> - </li> - {{- else if $shouldEllipse }} - <li class="page-item disabled"> - <span aria-hidden="true"> … </span> - </li> - {{- end -}} + </li> + {{- else if $shouldEllipse }} + <li class="page-item disabled"> + <span aria-hidden="true"> … </span> + </li> + {{- end -}} {{- end }} </ul> {{ end }}