Skip to content

Commit

Permalink
fix: Use $.Page.RenderString instead of markdownify
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed May 31, 2022
1 parent 32f5767 commit 09d7fca
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/li.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
-->
<li>
<a href='{{ .Permalink }}'> {{ .Title }}</a>
{{ .Description | markdownify }}
{{ .Description | $.Page.RenderString | emojify }}
</li>
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h1 class="post-title">{{ .Title }}</h1>
<hr />
<h3>Description/Summary</h3>
{{ with .Description }}
{{ . | markdownify }}
{{ . | $.Page.RenderString | emojify }}
{{ else }}
{{ partial "summary_minus_toc.html" . | safeHTML }}
{{ end }}
Expand Down
12 changes: 6 additions & 6 deletions layouts/partials/header_image.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ <h3>Featured/Header Image</h3>
{{ $size := .Params.size | default 800 }}
{{ $image := $original.Resize (printf "%dx" $size) }}
<figure style="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc">
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
<figcaption>
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
<figcaption>
{{ with .Params }}
{{ with .caption }}
{{ . | markdownify }}
{{ with .caption }}
{{ . | $.Page.RenderString | emojify }}
{{ end }}
{{ if .credit }}
{{ printf "(Credit:&nbsp;" | safeHTML -}}
{{- with .url -}}
{{- printf `<a href="%s">` . | safeHTML -}}
{{- end -}}
{{- .credit | markdownify -}}
{{- .credit | $.Page.RenderString -}}
{{- with .url -}}
{{- printf "</a>" | safeHTML -}}
{{- end -}}
{{- printf ")" | safeHTML }}
{{ end }}
{{ end }}
</figcaption>
</figcaption>
</figure>
{{ if (not ($.Param "disable_debug")) }}
{{ with .Params }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ $permalink_pretty := .Permalink | replaceRE "\\.html$" "/" }} <!-- Always have a trailing slash, even with uglyURLs enabled. -->
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description"
content="{{ with .Description }}{{ . | markdownify | plainify }}{{ else }}{{ if .IsPage }}{{ partial "summary_minus_toc.html" . | markdownify | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . | markdownify | plainify }}{{ end }}{{ end }}{{ end }}" />
content="{{ with .Description }}{{ . | $.Page.RenderString | plainify }}{{ else }}{{ if .IsPage }}{{ partial "summary_minus_toc.html" . | $.Page.RenderString | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . | $.Page.RenderString | plainify }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with .Params.images }}
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/summary_minus_toc.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- with .Description -}}
{{- . | markdownify | printf "<p>%s</p>" | safeHTML -}}
{{- . | $.Page.RenderString | printf "<p>%s</p>" | safeHTML -}}
{{- else -}}
{{- $summary_has_org_toc := substr .Content 0 30 | findRE "[\".]ox-hugo-toc" -}}
{{- if $summary_has_org_toc -}}
Expand All @@ -9,9 +9,9 @@
{{- $summary_raw := index $content_splits 1 -}}
{{- $summary_splits := split $summary_raw "<!--more-->" -}}
{{- if eq (len $summary_splits) 2 -}}
{{- index $summary_splits 0 | markdownify -}}
{{- index $summary_splits 0 | $.Page.RenderString -}}
{{- else -}}
{{- $summary_raw | markdownify | truncate 300 -}}
{{- $summary_raw | $.Page.RenderString | truncate 300 -}}
{{- end -}}
{{- else -}}
<!-- Print the whole Summary if endtoc special comment is not found. -->
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/twitter_cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{{- end -}}
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . | markdownify | plainify }}{{ else }}{{ if .IsPage }}{{ partial "summary_minus_toc.html" . | markdownify | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . | markdownify | plainify }}{{ end }}{{ end }}{{ end -}}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . | $.Page.RenderString | plainify }}{{ else }}{{ if .IsPage }}{{ partial "summary_minus_toc.html" . | $.Page.RenderString | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . | $.Page.RenderString | plainify }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
<meta name="twitter:creator" content="@{{ . }}"/>
Expand Down
6 changes: 3 additions & 3 deletions layouts/shortcodes/figure2.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!-- image -->
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
{{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }}
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" | markdownify | plainify }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/>
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" | $.Page.RenderString | plainify }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/>
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
<h4>{{ .Get "title" }}</h4>{{ end }}
{{ if or (.Get "caption") (.Get "attr")}}<p>
{{ .Get "caption" | markdownify }}
{{ .Get "caption" | $.Page.RenderString }}
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
{{ .Get "attr" | markdownify }}
{{ .Get "attr" | $.Page.RenderString }}
{{ if .Get "attrlink"}}</a> {{ end }}
</p> {{ end }}
</figcaption>
Expand Down

0 comments on commit 09d7fca

Please sign in to comment.