Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language meta label and <h1> needed for better SEO #170

Open
Steven52065 opened this issue Nov 5, 2023 · 2 comments
Open

Language meta label and <h1> needed for better SEO #170

Steven52065 opened this issue Nov 5, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Steven52065
Copy link

Describe the bug
head里好像没有元语言标签,按理说在config.toml里面设置了languageCode = 'zh-cn'后应该会添加到网页的head里面的,不过好像没有;
博文页面的标题使用的是div,好像不太适合搜索引擎识别(bing是这么说的
image

Screenshots
image

Environment
hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended windows/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
Chrome 117.0.5938.150(正式版本) (64 位)

Additional context
关于元语言标签,我在layouts\partials\extended_head.html 里面添加了一句
<meta http-equiv ='content-language' content ='zh-cmn-Hans'> 解决了(不过感觉直接用config.toml里面的设置会比较合理?)
关于博文页面标题,我将\themes\diary\layouts_default\single.html 的第22行( {{ .Title }} )修改为了
<h1 class="post-title">{{ .Title }}</h1> 解决了,但是这样会导致页面的格局发生一些变化...(这样改大概不太合适....)
抱歉我不太会修改这些(就不乱提pr了 QAQ ),所以希望作者可以在空闲之余修改一下,感谢。

@AmazingRise
Copy link
Owner

Hi @Steven52065
Thanks for your feedback.
As for the language <meta> label, I'm considering to add an optional configuration in config.toml.
And as for <h1>, I'll try to find a way to import it without changing the title's original style.

@AmazingRise AmazingRise reopened this Dec 18, 2023
@AmazingRise AmazingRise added the enhancement New feature or request label Dec 18, 2023
@AmazingRise AmazingRise changed the title 缺少元语言标签以及文章页面缺少h1标签 Language meta label and <h1> needed for better SEO Dec 18, 2023
@loikein
Copy link

loikein commented Dec 18, 2023

Please consider adding lang attribute to <html> instead of <meta> tag, as the latter is considered bad practice: Content-Language - HTTP | MDN.

FYI, PageSpeed stopped complaining after I added this in baseof.html:

<html lang="{{ default .Site.Language.LanguageCode .Params.Language }}">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants