mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: cache nested articles #380
This commit is contained in:
parent
1d1f5fad91
commit
5971d3d5fa
3 changed files with 9 additions and 6 deletions
|
@ -93,11 +93,7 @@
|
||||||
{{- $outputFormat := .outputFormat }}
|
{{- $outputFormat := .outputFormat }}
|
||||||
{{- with .sect }}
|
{{- with .sect }}
|
||||||
{{- $page := . }}
|
{{- $page := . }}
|
||||||
{{/* 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 */}}
|
{{- partialCached "nested-content.hugo" (dict "page" $page "outputFormat" $outputFormat) $page.RelPermalink "outputFormat" $outputFormat }}
|
||||||
{{- $link_prefix := strings.TrimRight "/" .Page.RelPermalink }}
|
|
||||||
{{- $content := partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" $page "outputFormat" $outputFormat) }}
|
|
||||||
{{- $content = replaceRE "((?:src|href)\\s*=(?:\\s*[\"']\\s*)?)(\\.[^\"'\\s>]*|[\\w]+[^\"'\\s>:]*)([\"'\\s>])" (printf "${1}%s/${2}${3}" $link_prefix) $content }}
|
|
||||||
{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content "outputFormat" $outputFormat) "outputFormat" $outputFormat) }}
|
|
||||||
{{- $currentNode.Page.Store.Set "nestedHasMathJax" (or ($currentNode.Page.Store.Get "nestedHasMathJax") (.Page.Store.Get "hasMathJax")) }}
|
{{- $currentNode.Page.Store.Set "nestedHasMathJax" (or ($currentNode.Page.Store.Get "nestedHasMathJax") (.Page.Store.Get "hasMathJax")) }}
|
||||||
{{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.Page.Store.Get "hasMermaid")) }}
|
{{- $currentNode.Page.Store.Set "nestedHasMermaid" (or ($currentNode.Page.Store.Get "nestedHasMermaid") (.Page.Store.Get "hasMermaid")) }}
|
||||||
{{- $currentNode.Page.Store.Set "nestedHasSwagger" (or ($currentNode.Page.Store.Get "nestedHasSwagger") (.Page.Store.Get "hasSwagger")) }}
|
{{- $currentNode.Page.Store.Set "nestedHasSwagger" (or ($currentNode.Page.Store.Get "nestedHasSwagger") (.Page.Store.Get "hasSwagger")) }}
|
||||||
|
|
7
layouts/partials/nested-content.hugo
Normal file
7
layouts/partials/nested-content.hugo
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{{- $page := .page }}
|
||||||
|
{{- $outputFormat := .outputFormat }}
|
||||||
|
{{- $c:=""}}{{/* 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 = replaceRE "((?:src|href)\\s*=(?:\\s*[\"']\\s*)?)(\\.[^\"'\\s>]*|[\\w]+[^\"'\\s>:]*)([\"'\\s>])" (printf "${1}%s/${2}${3}" $link_prefix) $content }}
|
||||||
|
{{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content "outputFormat" $outputFormat) "outputFormat" $outputFormat) }}
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="expand
|
<div class="expand
|
||||||
{{- if $expanded }} expand-expanded{{ end -}}
|
{{- if $expanded }} expand-expanded{{ end -}}
|
||||||
">
|
">
|
||||||
{{/* things are getting complicated when search tries to open the expand box while jquery sets the display CSS on the element */}}{{ "" -}}
|
{{- $c:=""}}{{/* things are getting complicated when search tries to open the expand box while jquery sets the display CSS on the element */}}
|
||||||
<a class="expand-label" onclick="$t=$(this); if($t.parent('.expand-expanded.expand-marked').length){ $t.next().css('display','none') }else if($t.parent('.expand-marked').length){ $t.next().css('display','block') }else{ $t.next('.expand-content').slideToggle(100); } $t.parent().toggleClass('expand-expanded');">
|
<a class="expand-label" onclick="$t=$(this); if($t.parent('.expand-expanded.expand-marked').length){ $t.next().css('display','none') }else if($t.parent('.expand-marked').length){ $t.next().css('display','block') }else{ $t.next('.expand-content').slideToggle(100); } $t.parent().toggleClass('expand-expanded');">
|
||||||
<i class="fas fa-chevron-down"></i>
|
<i class="fas fa-chevron-down"></i>
|
||||||
<i class="fas fa-chevron-left expand-rtl direction-{{ $direction }}"></i>
|
<i class="fas fa-chevron-left expand-rtl direction-{{ $direction }}"></i>
|
||||||
|
|
Loading…
Reference in a new issue