[SOLVED] Inherit meta keywords


#1

Hello

I would like the metadata -> keywords of each page to append after the ones listed in user/config/site.yaml, instead of replacing them.

More generally, it would be nice if we could specify for each .md file if the list of keywords should be based (and complete) the list of another page.

Sometimes it may be useful to completely replace the list instead of appending keywords, so if no base page would be specified, this would be default.

Is this possible with the current version of Grav?

Regards,


#2

@mathmax Instead of answering your question, I would like to broaden it with respect to the usefulness of meta keywords.

I am by no means a SEO expert, so correct me if I’m wrong…

From what I’ve read/learned on the topic of SEO: Keywords are dead, long live the keywords.

Keywords as a meta tag are no longer used by Google (and probably others) for a long time. Since 2009 I believe…

But using the right keywords in other parts of the page is however very important. And ‘right keywords’ means keywords that very well describe the content of a page and are used by users in their search query.

These other parts that are more important and indicative for the content of a page and hence have more impact on SEO when containing the right keyword, are:

  • Url
  • Title tag
  • Meta description
  • Page content
  • Header and subheaders
  • Image alt text
  • Internal linking
  • Domain name

Hope this helps…


#3

This simplifies a lot my original question. :grinning:
Problem solved then!

Just for curiosity: is it possible to handle the same kind of logic from the MD file, not for keywords, but lets say another set of custom options that I defined in the YAML frontMatter?


#4

@mathmax You could try something like adding your own field to the header of a page like:

meta: append # or replace, or ...

and use some logic in Twig:

{% set mymeta = page.meta == 'append' ? <append logic> : <replace logic> %}

#5

sounds good. Thank you for the tip.