mirror of
https://github.com/foo-dogsquared/hugo-theme-more-contentful.git
synced 2025-01-30 22:57:57 +00:00
Make a few tweaks to the theme
This commit is contained in:
parent
e81b882549
commit
9487442d64
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -59,7 +59,7 @@ a {
|
||||
}
|
||||
|
||||
dd, li, p, td {
|
||||
line-height: 1.5;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
p {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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]]
|
||||
|
@ -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 }}
|
||||
|
||||
|
@ -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 }}
|
||||
|
@ -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 -}}
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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 }}
|
||||
|
Loading…
Reference in New Issue
Block a user