Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

[SOLVED] Inherit meta keywords

Solved by pamtbaau View solution

Started by maxime 7 years ago · 4 replies · 753 views
7 years ago

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,

7 years ago Solution

@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...

👍 1
7 years ago

This simplifies a lot my original question. 😀
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?

7 years ago

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

TXT
meta: append # or replace, or ...

and use some logic in Twig:

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

sounds good. Thank you for the tip.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago