Hi,
I have a Site.Params.Description variable, and for some article a local Params.Description variable.
Without writing anything, it automatically writes a variable with the content of the local description in the frontmatter but when I write one, it defaults not on the site’s description but on the first 70 words !
My syntax ({{ default Site.Params.description Params.description }}) worked, I verified with other tags. It’s hugo.
Instead of antagonistic approach, share your code and examples with a positive outlook for help. This forum responds well to the latter, no one likes the former. Everyone knows the documentation isn’t ideal and that the forum is extremely helpful and supportive.
It is very helpful, I agree.
This is the content of my “inject/head.html”:
<meta name="google-site-verification"
content="mdMoGmf5Zty-b7lyk25zBDtyeEVU-AIfFa70TVLqsV0" />
<meta name="keywords" content=
"{{ default .Site.Params.Keywords .Params.Keywords}}">
<meta property="og:image" content=
"{{ default .Site.Params.BookLogo .Params.Logo }}">
<meta name="twitter:card" content=
"{{ default .Site.Params.BookLogo .Params.Logo }}">
<meta name="twitter:title" content=
"{{ if .IsHome }}
{{ .Site.Title }}
{{ else }}{{ .Title }} · {{ .Site.Title }}
{{ end }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
{{ if isset .Params "date" }}
<meta property="article:published_time" content=
"{{ (time .Date).Format "2006-01-02T15:04:05Z" }}">
{{ end }}
No other template has any <meta property=“og:description” …> tag.
My params:
[params]
BookLogo = “/Images/history/favicons/symbole_perso_deux_arbres.png”
BookTheme = ‘dark’
BookSearch = true
BookPortableLinks = true
BookServiceWorker = true
BookTranslatedOnly = true
disablePathToLower = false
BookComments = true
Description = “The purpose of this site is to promote a completely overhaul of our culture, scientifically and spiritually, rehabilitating our animal nature terms of food, health and love.”
- I don’t see any
"og:description"
tag in that snippet, nor the use of.Params.Description
. - You should be using camelCase with your site params and frontmatter params.
bookLogo
bookTheme
And use them as .Site.Params.bookLogo .Params.logo
- Exact, I didn’t. I did before but the result was TWO og:description tag popping up in the html, the second being empty “” and a first one. Without my supplementary tag (which was written correctly, I checked), it still produces the first one, which behaves as I said: simply ignoring .Site.description
- Sure, better aesthetics, though I doubt it relates to our issue since the only tag that changes, is description, which is read as well in lower case or camel case, both in front matters and the config.
It all seems like a weird bug to me.
not sure what editor you use but if you use Visual Studio Code, it’s trivial to search your project for a string and see which files have it. I recommend something like that. It’s possible that an internal template is being used creating the second instance you see (or only instance in this case) and it would then depend on what your templates are calling.
Without your full project, it’s hard to give a direct answer.
Nothing at all that is visible (in text format) has the chain og:description, in upper lower or whatever case. I searched through all the site with broot (c/og:description). I’m positive.
At least with hugo-book, I confirm that this behavior is generic.
Honestly I thought that a theme was just a collection of text files that we could edit however we please ? there’s none of this tag in templates so… It’s hugo.
Are you using the opengraph partial somewhere? Can you share your repo?
Ok, this is a problem with “can’t evaluate field description in type *hugolib.pageState”.
Has it found a solution ? Why is .Site.Params.description suddenly not recognized anymore ?
How can it be related to the theme ?
I looked on my theme’s webpage and read:
To disable Open Graph inclusion you can create your own empty file \layouts_internal\opengraph.html. In fact almost empty not quite empty because an empty file looks like absent for HUGO. For example:
Yes it was the theme, but given I had removed {{- template "_internal/opengraph.html" . -}}
it still baffles me how it could do anything…