I’m trying to create a default meta in WP Yoast SEO style. The idea is to have a parameter in config.toml that is called when I don’t have any title or description data in my markdown file.
I have this code in my header partial
{{ if eq .Type "post" }}
{{$title_default = .Site.Params.post_title | markdownify }}
{{ else if eq .Type "category" }}
{{$title_default = .Site.Params.category_title | markdownify }}
{{ else if eq .Type "tag" }}
{{$title_default = .Site.Params.tag_title | markdownify }}
{{ end }}
And than I call a condition
<title>{{if .Title}}{{.Title | markdownify}}{{else}}{{$title_default}}{{end}}</title>
In my config file I have this params
page_title = "{{<post_title>}} {{<sep>}} 🏆 {{<sitename>}} some text"
category_title = "Some text {{<post_title>}} {{<sep>}} {{<sitename>}}"
provider_title = "{{<post_title>}} some text {{<post_title>}}"
It works pretty well, all except the {{<post_title>}} part. I’m trying to get post name, but it always gets content from my main page md file. How can I fix it, or is there any other way to make dynamic meta in config?