Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/css/common/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
display: inline-flex;
}

.nav-sep {
color: var(--secondary);
}

.lang-menu * {
display: inherit;
min-height: inherit;
Expand Down
6 changes: 5 additions & 1 deletion layouts/_partials/anchored_headings.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
{{- /* formats .Content headings by adding an anchor */ -}}
{{ . | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">#</a>${3}" | safeHTML }}
{{ . | replaceRE
"(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)"
"${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">#</a>${3}"
| safeHTML
}}
15 changes: 8 additions & 7 deletions layouts/_partials/author.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{- if or .Params.author site.Params.author }}
{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- (delimit $author ", " ) }}
{{- else }}
{{- $author }}
{{- end }}
{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}

{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- (delimit $author ", " ) }}
{{- else }}
{{- $author }}
{{- end }}
{{- end -}}
29 changes: 13 additions & 16 deletions layouts/_partials/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
{{- if (.Param "ShowBreadCrumbs") -}}
<nav class="breadcrumbs" role="navigation" aria-label="Breadcrumb">
<a href='{{ "" | absLangURL }}'>
{{- i18n "home" | default "Home" -}}
</a>
{{- $url := replace .Parent.Permalink (printf "%s" site.Home.Permalink) "" }}
{{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}}
{{- $scratch := newScratch }}
{{- range $index, $element := split $lang_url "/" }}
{{- $scratch.Add "path" (printf "%s/" $element )}}
{{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
{{- $ancestors := .Ancestors.Reverse -}}
{{- range $i, $bc := $ancestors }}
{{- if eq $i 0 }}
<a href="{{ $bc.RelPermalink }}">{{ i18n "home" | default "Home" }}</a>
{{- else }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
<a href="{{ $bc_pg.Permalink }}">
{{- $bc_pg.Name -}}
</a>
<a href="{{ $bc.RelPermalink }}">{{ $bc.Title }}</a>
{{- end }}
{{- end -}}
{{- end }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</nav>
{{- end -}}
26 changes: 18 additions & 8 deletions layouts/_partials/edit_post.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{{- if and (or .Params.editPost.URL site.Params.editPost.URL) (not (.Param "editPost.disabled")) -}}
{{- $fileUrlPath := path.Join .File.Path }}
{{- if and (.Param "editPost.URL") (not (.Param "editPost.disabled")) -}}
{{- if or (.Param "author") (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}
{{- printf "&nbsp;|&nbsp;" | safeHTML -}}
{{- end -}}

{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}}
<span>
<a href="{{ .Params.editPost.URL | default site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer edit" target="_blank">
{{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
</a>
</span>
{{- $editURL := .Param "editPost.URL" }}
{{- $appendFilePath := .Param "editPost.appendFilePath" | default false }}
{{- $editText := .Param "editPost.Text" | default (i18n "edit_post" ) -}}

{{- if $appendFilePath -}}
{{- $fileUrlPath := path.Join .File.Path }}
{{- $editURL = printf "%s/%s" $editURL $fileUrlPath -}}
{{- end -}}

<span>
<a href="{{ $editURL }}" rel="noopener noreferrer edit" target="_blank">
{{- $editText -}}
</a>
</span>
{{- end }}
9 changes: 8 additions & 1 deletion layouts/_partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
{{- print " · "}}
{{- end }}

{{/*
- The "Powered by Hugo" text is intentionally left at the end of the footer to give it more prominence.
- We kindly encourage you to keep this line. Keeping this credit helps open source projects like PaperMod and Hugo reach more people, supports the open source ecosystem, and shows appreciation for the work that goes into these tools.
- If you choose to remove it, please consider adding a link to the PaperMod GitHub repository somewhere on your site to give credit to the project and its contributors.
- Support us by sponsoring the project on GitHub Sponsors: https://github.com/sponsors/adityatelange
*/}}

<span>
Powered by
<a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a> &
<a href="https://gohugo.io/?utm_source=papermod" rel="noopener" target="_blank">Hugo</a> &
<a href="https://github.com/adityatelange/hugo-PaperMod/" rel="noopener" target="_blank">PaperMod</a>
</span>
</footer>
Expand Down
6 changes: 3 additions & 3 deletions layouts/_partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
<div class="logo-switches">
{{- if (not site.Params.disableThemeToggle) }}
<button id="theme-toggle" class="theme-toggle" accesskey="t" title="(Alt + T)" aria-label="Toggle theme">
<svg class="moon" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"
<svg class="moon" xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg class="sun" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"
<svg class="sun" xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
Expand All @@ -62,7 +62,7 @@
{{- $lang := .Lang}}
{{- with site.Home.Translations }}
{{- $separator := or $label_text (not site.Params.disableThemeToggle)}}
{{- if $separator }}<span>|</span>{{ end }}
{{- if $separator }}<span class="nav-sep">|</span>{{ end }}
<ul class="lang-menu">
{{- range . -}}
{{- if ne $lang .Lang }}
Expand Down
16 changes: 9 additions & 7 deletions layouts/_partials/post_meta.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{{- $scratch := newScratch }}

{{- if not .Date.IsZero -}}
{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default ":date_long" site.Params.DateFormat)))) }}
{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default ":date_long" site.Params.DateFormat)))) }}
{{- end }}

{{- if (.Param "ShowReadingTime") -}}
{{- $scratch.Add "meta" (slice (printf "<span>%s</span>" (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime)))) }}
{{- $scratch.Add "meta" (slice (printf "<span>%s</span>" (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime)))) }}
{{- end }}

{{- if (.Param "ShowWordCount") -}}
{{- $scratch.Add "meta" (slice (printf "<span>%s</span>" (i18n "words" .WordCount | default (printf "%d words" .WordCount)))) }}
{{- $scratch.Add "meta" (slice (printf "<span>%s</span>" (i18n "words" .WordCount | default (printf "%d words" .WordCount)))) }}
{{- end }}

{{- if not (.Param "hideAuthor") -}}
{{- with (partial "author.html" .) }}
{{- $scratch.Add "meta" (slice (printf "<span>%s</span>" .)) }}
{{- end }}
{{- with (partial "author.html" .) }}
{{- $scratch.Add "meta" (slice (printf "<span>%s</span>" .)) }}
{{- end }}
{{- end }}

{{/* Combine all meta information into a single string with separators and render it as HTML.*/}}

{{- with ($scratch.Get "meta") }}
{{- delimit . "&nbsp;·&nbsp;" | safeHTML -}}
{{- delimit . "&nbsp;·&nbsp;" | safeHTML -}}
{{- end -}}
36 changes: 19 additions & 17 deletions layouts/_partials/translation_list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{{- if .IsTranslated -}}
{{- if (ne .Layout "search") }}
{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}}
{{- end -}}
<span>{{- i18n "translations" | default "Translations" }}:</span>
<ul class="i18n_list">
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">
{{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}}
{{- else }}
{{- .Lang | title -}}
{{- end -}}
</a>
</li>
{{- end }}
</ul>
{{- if (ne .Layout "search") }}
{{- if or (.Param "author") (.Param "ShowReadingTime") (not .Date.IsZero) }}
{{- printf "&nbsp;|&nbsp;" | safeHTML -}}
{{- end -}}
{{- end -}}
<span>{{- i18n "translations" | default "Translations" }}:</span>
<ul class="i18n_list">
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">
{{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}}
{{- else }}
{{- .Lang | title -}}
{{- end -}}
</a>
</li>
{{- end }}
</ul>
{{- end -}}
16 changes: 8 additions & 8 deletions layouts/taxonomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ <h1>{{ .Title }}</h1>

<ul class="terms-tags">
{{- $type := .Type }}
{{- range $key, $value := .Data.Terms.Alphabetical }}
{{- $name := .Name }}
{{- $count := .Count }}
{{- with site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<a href="{{ .Permalink }}">{{ .LinkTitle }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li>
{{- end }}
{{- range $key, $value := .Data.Terms.Alphabetical }}
{{- $name := .Name }}
{{- $count := .Count }}
{{- with site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<a href="{{ .Permalink }}">{{ .LinkTitle }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li>
{{- end }}
{{- end }}
</ul>

Expand Down
Loading