mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 10:50:24 +00:00
theme: detect output format where it is needed #891
This commit is contained in:
parent
4d706da3fc
commit
ac4faed5d8
10 changed files with 19 additions and 34 deletions
|
@ -1,9 +1,8 @@
|
|||
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
||||
{{- $outputFormat := partial "output-format.hugo" . }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "header" "page" . "parameter" . "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "header" "page" . "parameter" .) }}
|
||||
{{- if not .File }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "initial" "page" . "parameter" . "outputFormat" $outputFormat))) "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "initial" "page" . "parameter" .)))) }}
|
||||
{{- else }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" . "outputFormat" $outputFormat))) "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) }}
|
||||
{{- end }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "footer" "page" . "parameter" . "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "footer" "page" . "parameter" .) }}
|
|
@ -1,10 +1,6 @@
|
|||
{{- $hook := .hook }}
|
||||
{{- $page := .page }}
|
||||
{{- $parameter := .parameter }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- if not $outputFormat }}
|
||||
{{- $outputFormat = partial "output-format.hugo" $page }}
|
||||
{{- end }}
|
||||
{{- $archetype := "default" }}
|
||||
{{- if not $page.File }}
|
||||
{{- else if $page.Params.archetype }}
|
||||
|
@ -24,4 +20,4 @@
|
|||
{{- if not (partialCached "fileExists.hugo" $f $f) }}
|
||||
{{- $archetype = "default" }}
|
||||
{{- end }}
|
||||
{{- partial "output-partial.hugo" (dict "base" (printf "archetypes/%s/%s" $archetype $hook) "page" $page "parameter" $parameter "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" (printf "archetypes/%s/%s" $archetype $hook) "page" $page "parameter" $parameter) }}
|
|
@ -1,5 +1,4 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- $hook := "article" }}
|
||||
{{- partialCached "archetype.hugo" (dict "hook" $hook "page" $page "parameter" (dict "page" $page "content" $content) "outputFormat" $outputFormat) $page.RelPermalink $outputFormat $hook }}
|
||||
{{- partialCached "archetype.hugo" (dict "hook" $hook "page" $page "parameter" (dict "page" $page "content" $content)) $page.RelPermalink $hook }}
|
|
@ -1,4 +1,3 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- $outputFormat := partial "output-format.hugo" .page }}
|
||||
{{- partial "single-article.hugo" (dict "page" $page "content" $content "outputFormat" $outputFormat) }}
|
||||
{{- partial "single-article.hugo" (dict "page" $page "content" $content) }}
|
|
@ -1,4 +1,3 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- $outputFormat := partial "output-format.hugo" .page }}
|
||||
{{- partial "nested-article.hugo" (dict "page" $page "outputFormat" $outputFormat) }}
|
||||
{{- partial "nested-article.hugo" (dict "page" $page) }}
|
|
@ -2,8 +2,7 @@
|
|||
</main><!-- #R-body-inner -->
|
||||
{{- partial "custom-comments.html" . }}
|
||||
</div><!-- #R-body -->
|
||||
{{- $outputFormat := partial "output-format.hugo" .Page }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "menu" "page" . "parameter" . "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "menu" "page" . "parameter" .) }}
|
||||
{{- $assetBusting := partialCached "assetbusting.hugo" . }}
|
||||
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $outputFormat := partial "output-format.hugo" . }}
|
||||
{{- if eq . .Site.Sites.First.Home }}
|
||||
{{- $hugoVersion := "0.126.0" }}
|
||||
{{- if lt hugo.Version $hugoVersion }}
|
||||
|
@ -69,5 +68,5 @@
|
|||
</nav>
|
||||
{{- $hook := "styleclass" }}
|
||||
<div id="R-main-overlay"></div>
|
||||
<main id="R-body-inner" class="highlightable {{ partialCached "archetype.hugo" (dict "hook" $hook "page" . "parameter" . "outputFormat" $outputFormat) .RelPermalink $outputFormat $hook }}" tabindex="-1">
|
||||
<main id="R-body-inner" class="highlightable {{ partialCached "archetype.hugo" (dict "hook" $hook "page" . "parameter" .) .RelPermalink $hook }}" tabindex="-1">
|
||||
<div class="flex-block-wrapper">
|
|
@ -1,16 +1,15 @@
|
|||
{{- $page := .page }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- $page.Page.Store.Set "relearnIsNested" true }}
|
||||
{{- with $page }}
|
||||
{{- $currentNode := . }}
|
||||
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .) }}
|
||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
||||
{{- if $pages }}
|
||||
<section>
|
||||
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
|
||||
{{- end }}
|
||||
{{- range $pages }}
|
||||
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
||||
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode }}
|
||||
{{- end }}
|
||||
{{- if $pages }}
|
||||
</section>
|
||||
|
@ -18,7 +17,6 @@
|
|||
{{- end }}
|
||||
{{- define "section-tree-print" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
|
||||
{{- with .sect }}
|
||||
{{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
|
||||
|
@ -28,13 +26,13 @@
|
|||
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
|
||||
{{- if $hidden }}
|
||||
{{- else }}
|
||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
||||
{{- if $pages }}
|
||||
<section>
|
||||
<h1 class="a11y-only">{{ T "Subsections" .Title }}</h1>
|
||||
{{- end }}
|
||||
{{- range $pages }}
|
||||
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "outputFormat" $outputFormat }}
|
||||
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode }}
|
||||
{{- end }}
|
||||
{{- if $pages }}
|
||||
</section>
|
||||
|
@ -44,10 +42,9 @@
|
|||
{{- end }}
|
||||
{{- define "section-print" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- with .sect }}
|
||||
{{- $page := . }}
|
||||
{{- partialCached "nested-content.hugo" (dict "page" $page "outputFormat" $outputFormat) $page.RelPermalink "outputFormat" $outputFormat }}
|
||||
{{- partialCached "nested-content.hugo" (dict "page" $page) $page.RelPermalink }}
|
||||
{{- range $page.Site.Params.relearn.dependencies }}
|
||||
{{- $has := printf "has%s" .name }}
|
||||
{{- $hasnested := printf "relearnHasNested%s" .name }}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
{{- $page := .page }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- $content := "" }}
|
||||
{{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }}
|
||||
{{- if $url }}
|
||||
{{- /* if we have a relative link in a print page, our print URL is one level to deep; so we are making it absolute to our page by prepending the page's permalink */}}
|
||||
{{- $link_prefix := strings.TrimRight "/" $page.RelPermalink }}
|
||||
{{- $content = partial "output-partial.hugo" (dict "base" "content" "page" $page "parameter" $page "outputFormat" $outputFormat) }}
|
||||
{{- $content = partial "output-partial.hugo" (dict "base" "content" "page" $page "parameter" $page) }}
|
||||
{{- $content = replaceRE "((?:src|href)\\s*=(?:\\s*[\"']\\s*)?)(\\.[^\"'\\s>]*|[\\w]+[^\"'\\s>:]*)([\"'\\s>])" (printf "${1}%s/${2}${3}" $link_prefix) $content }}
|
||||
{{- end }}
|
||||
{{- if $page.Title }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content "outputFormat" $outputFormat) "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }}
|
||||
{{- end }}
|
|
@ -1,5 +1,4 @@
|
|||
{{- $page := .page }}
|
||||
{{- $content := .content }}
|
||||
{{- $outputFormat := .outputFormat }}
|
||||
{{- $page.Page.Store.Set "relearnIsNested" false }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content "outputFormat" $outputFormat) "outputFormat" $outputFormat) }}
|
||||
{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }}
|
Loading…
Reference in a new issue