Arif
January 20, 2023, 5:39pm
1
In my head.html
file, I am defining variables for open graph tags like so
{{- $title := .Title }}
{{- if .IsHome }}
{{- $title = site .Title }}
{{- else if and .IsSection (eq .Section "story")
{{- $title = .Title }}
<!-- more conditionals -->
{{- end }}
I want the $title
for the story section to be {{ .Title }} | {{ site .Title }}
. Is that possible? If so, how?
Arif
January 20, 2023, 6:00pm
3
An example? For the life of me, I cannot grasp that doc section.
printf
is a frequently used function that is common in most, perhaps all, programming languages. I encourage you to spend some time learning/experimenting.
{{ $a := "foo" }}
{{ $b := "bar" }}
{{ printf "%s-%s" $a $b }} --> foo-bar
2 Likes
Arif
January 20, 2023, 6:13pm
5
The docs on functions are very brief and concise. This is easier to grasp.
system
Closed
January 22, 2023, 6:14pm
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.