Skip to content
Snippets Groups Projects
Commit e9536ae1 authored by alexisben's avatar alexisben
Browse files

refacto toc conditions

parent 51840760
No related branches found
No related tags found
No related merge requests found
......@@ -2,46 +2,14 @@
{{ partial "pages/hero.html" . }}
<div class="document-content">
{{/* TOC PART */}}
{{- $category := site.GetPage (printf "/categories%s" .Params.category) -}}
{{- $show_aside := false -}}
{{- $has_blocks := false -}}
{{- range .Params.blocks -}}
{{- $has_blocks = true -}}
{{- if .title -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if .Pages -}}
{{- if eq $has_blocks false -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if .Content -}}
{{- if eq $has_blocks false -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if $category -}}
{{- if eq $has_blocks false -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if $show_aside }}
{{ partial "toc/container.html"
(dict
"category" $category
"toc" "pages/toc.html"
"context" .
)
}}
{{ end }}
{{ partial "toc/container.html"
(dict
"category" $category
"toc" "pages/toc.html"
"context" .
)
}}
{{ partial "hooks/after-page-hero.html" . }}
......
......@@ -8,7 +8,7 @@
{{- $bodyclass = printf "full-width %s" $bodyclass -}}
{{- end -}}
{{- if .Params.layout.offcanvas -}}
{{- if .Params.layout.toc.offcanvas -}}
{{- $bodyclass = printf "offcanvas-toc %s" $bodyclass -}}
{{- end -}}
......
{{ $isNeeded := false }}
{{ if eq .context.Type "programs" }}
{{ $isNeeded = true }}
{{ end }}
{{ if .context.Params.blocks }}
{{ if gt (len .context.Params.blocks) 1 }}
{{ $isNeeded = true }}
{{ end }}
{{ end }}
{{ return $isNeeded }}
\ No newline at end of file
{{ return .context.Params.layout.toc.present }}
\ No newline at end of file
<div class="document-content" itemscope itemtype="https://schema.org/EducationalOccupationalCredential">
<meta itemprop="name" content="{{ partial "PrepareHTML" .Title }}">
<meta itemprop="url" content="{{ .Permalink }}">
{{ partial "toc/container.html"
(dict
(dict
"toc" "programs/toc.html"
"context" .
)
}}
<meta itemprop="name" content="{{ partial "PrepareHTML" .Title }}">
<meta itemprop="url" content="{{ .Permalink }}">
}}
{{- if .Params.image -}}
{{- $id := .Params.image -}}
{{- if isset .Params.image "id" -}}
......
{{- $show_aside := false -}}
{{- $has_blocks := false -}}
{{- range .context.Params.blocks -}}
{{- $has_blocks = true -}}
{{- if .title -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if .context.Pages -}}
{{- if eq $has_blocks false -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if .context.Content -}}
{{- if eq $has_blocks false -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if .category -}}
{{- if eq $has_blocks false -}}
{{- $show_aside = true -}}
{{- end -}}
{{- end -}}
{{- if $show_aside }}
<nav class="toc toc-pages" id="nav-toc" aria-labelledby="toc-title">
<ol>
{{- if .context.Params.blocks -}}
{{- partial "blocks/toc.html" .context.Params.blocks -}}
{{- end -}}
</ol>
</nav>
{{ end -}}
<nav class="toc toc-pages" id="nav-toc" aria-labelledby="toc-title">
<ol>
{{- if .context.Params.blocks -}}
{{- partial "blocks/toc.html" .context.Params.blocks -}}
{{- end -}}
</ol>
</nav>
......@@ -2,6 +2,11 @@
{{ partial "posts/hero-single.html" . }}
<div class="document-content" itemscope itemtype="https://schema.org/NewsArticle">
<meta itemprop="headline" content="{{ partial "PrepareHTML" .Title }}">
<meta itemprop="url" content="{{ .Permalink }}">
{{ if .Date }}<meta itemprop="datePublished" content="{{ .Date.Format "2006-01-02T15:04" }}">{{ end }}
{{ if .Params.description_short }}<meta itemprop="abstract" content="{{ partial "PrepareHTML" .Params.description_short }}">{{ end }}
{{ if .Summary }}<meta itemprop="description" content="{{ partial "PrepareHTML" .Summary }}">{{ end }}
{{ partial "toc/container.html"
(dict
......@@ -10,15 +15,8 @@
)
}}
<meta itemprop="headline" content="{{ partial "PrepareHTML" .Title }}">
<meta itemprop="url" content="{{ .Permalink }}">
{{ if .Date }}<meta itemprop="datePublished" content="{{ .Date.Format "2006-01-02T15:04" }}">{{ end }}
{{ if .Params.description_short }}<meta itemprop="abstract" content="{{ partial "PrepareHTML" .Params.description_short }}">{{ end }}
{{ if .Summary }}<meta itemprop="description" content="{{ partial "PrepareHTML" .Summary }}">{{ end }}
{{ partial "posts/aside.html" . }}
{{ partial "posts/chapo.html" (dict
"context" .
"block_wrapped" true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment