Merge pull request #112 from zjedi/feat/safeHTML-headers-footers

safeHTML used for header, footer and content titles
This commit is contained in:
zjedi 2023-03-21 00:34:21 +01:00 committed by GitHub
commit 67434f0a8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View file

@ -3,6 +3,7 @@
header_image: "images/cover-image.jpg" header_image: "images/cover-image.jpg"
# Optional header logo. CSS: `#blog-logo`, with max-height defined, optimize to prevent scaling # Optional header logo. CSS: `#blog-logo`, with max-height defined, optimize to prevent scaling
header_logo: "images/chef-hat.png" header_logo: "images/chef-hat.png"
# Headers are safeHTML, you can use HTML tags such as b,i,u,br
header_headline: "Jane Doe" header_headline: "Jane Doe"
header_subheadline: "Hi there , I am a Nutrition Coach & Chef Consultant" header_subheadline: "<b>Nutrition</b> Coach & <b>Chef</b> Consultant"
--- ---

View file

@ -10,7 +10,7 @@
{{ with .Params.header_logo }}<img id="blog-logo" src="{{ . }}" />{{ end }} {{ with .Params.header_logo }}<img id="blog-logo" src="{{ . }}" />{{ end }}
{{ if .Site.Params.title_guard }}<div class="title-and-description-guard">{{ end }} {{ if .Site.Params.title_guard }}<div class="title-and-description-guard">{{ end }}
{{ with .Params.header_headline }}<h1 class="blog-title">{{ . | safeHTML }}</h1>{{ end }} {{ with .Params.header_headline }}<h1 class="blog-title">{{ . | safeHTML }}</h1>{{ end }}
{{ with .Params.header_subheadline }}<h2 class="blog-description">{{ . }}</h2>{{ end }} {{ with .Params.header_subheadline }}<h2 class="blog-description">{{ . | safeHTML }}</h2>{{ end }}
{{ if .Site.Params.title_guard }}</div>{{ end }} {{ if .Site.Params.title_guard }}</div>{{ end }}
{{ range where $sections ".Params.header_menu" "eq" true }} {{ range where $sections ".Params.header_menu" "eq" true }}
{{ if isset .Params "external" }} {{ if isset .Params "external" }}
@ -31,7 +31,7 @@
<div class='post-holder'> <div class='post-holder'>
<article id='{{ anchorize .Title }}' class='post {{ if eq $index_val 0 }}first{{ end }} {{ if eq (add $index_val 1) (len $sections) }}last{{ end }}'> <article id='{{ anchorize .Title }}' class='post {{ if eq $index_val 0 }}first{{ end }} {{ if eq (add $index_val 1) (len $sections) }}last{{ end }}'>
<header class="post-header"> <header class="post-header">
<h2 class="post-title">{{ .Title }}</h2> <h2 class="post-title">{{ .Title | safeHTML }}</h2>
</header> </header>
<section class="post-content"> <section class="post-content">
{{ .Content }} {{ .Content }}

View file

@ -1,14 +1,16 @@
<footer class="site-footer"> <footer class="site-footer">
<div class="inner"> <div class="inner">
{{ with .Site.Params.copyright }} {{ with .Site.Params.copyright }}
<section class="copyright">{{ . | markdownify }}</section>{{ end }} <section class="copyright">{{ . | safeHTML }}</section>
{{ end }}
<section>{{ echoParam .Site.Params "hidebyline" }}</section> <section>{{ echoParam .Site.Params "hidebyline" }}</section>
{{ if ne .Site.Params.hidedesignbyline true }} {{ if ne .Site.Params.hidedesignbyline true }}
<section> <section>
<a href="https://themes.gohugo.io/hugo-scroll/">Hugo Scroll</a> template <a href="https://themes.gohugo.io/hugo-scroll/">Hugo Scroll</a> template
</section>{{ end }} </section>
{{ end }}
</div> </div>
</footer> </footer>