From 4adf99061bb24438e1485b4d5cfc357600bdb017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 29 Aug 2024 14:23:55 +0200 Subject: [PATCH] theme: make migration easier #891 content.html is meant to be overloaded by the user and it should just work so every logic needs to be put somewhere else --- layouts/_default/views/article.html | 2 +- layouts/chapter/views/article.html | 2 +- layouts/home/views/article.html | 2 +- layouts/partials/article-content.html | 4 ++++ layouts/partials/content.html | 5 +---- 5 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 layouts/partials/article-content.html diff --git a/layouts/_default/views/article.html b/layouts/_default/views/article.html index 40662471172..f79eab05f11 100644 --- a/layouts/_default/views/article.html +++ b/layouts/_default/views/article.html @@ -5,7 +5,7 @@ {{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }} -{{ partial "content.html" . | safeHTML }} +{{ partial "article-content.html" . }} diff --git a/layouts/chapter/views/article.html b/layouts/chapter/views/article.html index 33a4cf28b4e..951b88baf15 100644 --- a/layouts/chapter/views/article.html +++ b/layouts/chapter/views/article.html @@ -6,7 +6,7 @@ {{ partial "heading-pre.html" . }}
{{ T "Chapter" .Params.Weight }}
{{ partial "heading.html" . }}{{ partial "heading-post.html" . }} -{{ partial "content.html" . | safeHTML }} +{{ partial "article-content.html" . }} diff --git a/layouts/home/views/article.html b/layouts/home/views/article.html index cfcd66b837c..f0c977bed6b 100644 --- a/layouts/home/views/article.html +++ b/layouts/home/views/article.html @@ -5,7 +5,7 @@ {{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }} -{{ partial "content.html" . | safeHTML }} +{{ partial "article-content.html" . }} diff --git a/layouts/partials/article-content.html b/layouts/partials/article-content.html new file mode 100644 index 00000000000..4e9604c1af1 --- /dev/null +++ b/layouts/partials/article-content.html @@ -0,0 +1,4 @@ +{{/* the following check avoids to print out content of headless bundles if called from nestedContent.gotmpl */}} +{{- if .RelPermalink }} +{{- partial "content.html" . | safeHTML }} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/content.html b/layouts/partials/content.html index 5fa15d1c64b..fb3ffc233c5 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -1,4 +1 @@ -{{- /* the following check avoids to print out content of headless bundles if called from nested-content.html */}} -{{- if partial "permalink.gotmpl" (dict "to" .) }} - {{- .Content }} -{{- end }} \ No newline at end of file +{{ .Content }} \ No newline at end of file