Closed ainy0293 closed 2 years ago
Later, I adjusted the code a bit, and adjusted as follows:
{{ if .IsHome }}
<meta name="keywords" content="{{ $.Site.Params.Keywords }}">
{{ else }}
{{ if .Keywords }}
<meta name="keywords" content="{{ $.Keywords }}">
{{ end }}
{{ end }}
The "keywords" keyword can be displayed, but there is a problem in the article page, the variable value read out is inconsistent with the expected.
An example of an article page is as follows:
+++
author = "yuanming"
title = "nginx example "
date = "2020-07-09"
description = "Detailed nginx configuration file"
keywords = "nginx,config,linux"
featured = true
tags = [
"nginx",
"linux"
]
series = ["nginx"]
+++
In the above example, the value of mate keywords
in the head element of the article page reads [nginx,config,linux]
, as follows:
<meta name="keywords" content="[nginx,conf,linux]">
This is not in line with the definition of the meta tag of the head element in the html language
Later, I changed the keywords
in the article to an array, for example: keywords = ["nginx","config","linux"]
, but the problem remains, there are [] characters, and no commas
Under normal circumstances, the definition standard of the meta tag of the head element should be.
<meta name="keywords" content="nginx,conf,linux">
So, here comes the unexpected string []
Since I'm not familiar with this hugo template, I don't know how to adjust it.
Demo site(keywords in string format): http://test.ifmx.cc/post/nginx/ Demo site(keywords in string Array): http://test.ifmx.cc/post/nginx-proxy/
Thanks.
@ainy0293, you can now set the keywords from each page. e.g keywords = ["design", "clarity","hugo theme"]
. while you could use a string too, it won't be as clean
"Keywords" keyword configuration of Search Engine SEO function.
I love this theme and recommend using it for post-testing.
At present, I have configured keywords in config.toml and params.toml, and content/_index.md in the config/_default directory, but they are not output to the static page.
The keywords of the article page cannot be output after configuration.
The comment plug-in hopes to support the comment plug-in of github, after all, the fees of disqus are still very high
Hope to add this feature in the future.
thanks.