CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.89k stars 1.6k forks source link

fix: head.html keywords parameter does not take effect #946

Closed L-Super closed 7 months ago

ottok commented 7 months ago

The keywords are supposed to come from the Front Matter tags, e.g.:

---
title: How to code 10x faster than an average programmer
date: 2023-01-29
keywords:
  - Entr
  - Atom
  - Pulsar
  - software quality
  - development velocity
  - developer productivity

This already work correctly. Your change would make every single page show the exact same keywords based on a site-wide configuration. I don't think that is how meta keywords should work?

L-Super commented 7 months ago

The keywords are supposed to come from the Front Matter tags, e.g.:

---
title: How to code 10x faster than an average programmer
date: 2023-01-29
keywords:
  - Entr
  - Atom
  - Pulsar
  - software quality
  - development velocity
  - developer productivity

This already work correctly. Your change would make every single page show the exact same keywords based on a site-wide configuration. I don't think that is how meta keywords should work?

My mistake, I originally wanted to fix the absence of the keywords parameter in index.html, which affects SEO. So are there other ways to solve this?

ottok commented 7 months ago

If you put this keywords: in your blog post, you will have in example.com/post/title/index.html the meta keywords.

According to Google they don't read the <meta keywords=""> stuff anymore, so this does not actually help with SEO and most modern sites don't use it. You would be better off reading about schema.org semantic markup, adding a custom layouts/partials/head/custom.html to your site, and testing with https://developers.google.com/search/docs/appearance/structured-data.

CaiJimmy commented 7 months ago

So are there other ways to solve this?

Technically, the homepage is just a special kind of page, hence it's possible to add frontmatter to it.

Try creating a content/_index.md file, with the following content:

---
keywords:
  - test
  - test2
---
L-Super commented 7 months ago

If you put this keywords: in your blog post, you will have in example.com/post/title/index.html the meta keywords.

According to Google they don't read the <meta keywords=""> stuff anymore, so this does not actually help with SEO and most modern sites don't use it. You would be better off reading about schema.org semantic markup, adding a custom layouts/partials/head/custom.html to your site, and testing with https://developers.google.com/search/docs/appearance/structured-data.

Thanks a lot