Meta: description does not show up

Hello,

the page in question is this one:
https://trolink.de/de/kofferrollen-austauschen

default.de.md starts as follows:

metadata:
    description: 'Herstellerunabhängig, Kugellagerrollen für leichten und leisen Lauf bei langer Haltbarkeit. Ab 20€ - rufen Sie uns an 030 / 120 11 352'
    refresh: '30'
    generator: Grav
    keywords: 'Koffer Rollen Ersatz Räder reparieren austauschen'
    author: 'Wolf Drechsel'
    robots: 'index, follow'
    my_key: my_value
---

> # Koffer Rollen ersetzen
> Die oft minderwertigen - oder einfach verschlissenen - Rollen der meisten Koffer lassen sich leicht gegen hochwertige, kugelgelagerte austauschen. ```

Whatever I do - the contents of the "description" metadata are not shown in the page's source code and cannot be found by a analysis tool like [https://www.seocentro.com/tools/search-engines/metatag-analyzer.html](https://www.seocentro.com/tools/search-engines/metatag-analyzer.html). Instead the first lines of my page content is used.

What could be wrong ? - Grav 1.5.6

Cheers,
Wolf

What does your base template say? That’s where head content would be added.

Is it true it’s this one: httpdocs/grav/user/themes/machine/templates/default.html.twig ?

This is what the first few lines say:

<html lang="en">
  <head>

    {% block head %}
      {% block head_meta %}
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

        {% for meta in page.metadata %}
          <meta {% if meta.name %}name="{{ meta.name }}" {% endif %}{% if meta.http_equiv %}http-equiv="{{ meta.http_equiv }}" {% endif %}{% if meta.charset %}charset="{{ meta.charset }}" {% endif %}{% if meta.property %}property="{{ meta.property }}" {% endif %}{% if meta.content %}content="{{ meta.content }}" {% endif %}/>
        {% endfor %}

        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta name="description" content="{{ site.metadata.description }}" />
      {% endblock %}

Do these infos help?

Whatever your issue was it seems to be fixed now as the tool linked is showing description meta of 282 characters for the page provided.

Think you misunderstood me. The analysis tool shows for “Description”:
“Koffer Rollen ersetzen als ServiceWir haben Erfahrung im Austausch von Koffer und Trolleyrollen seit 2014…”, which is the beginning of my page contents.

But I inserted there: “Herstellerunabhängig, Kugellagerrollen für leichten und leisen Lauf bei langer Haltbarkeit. Ab 20€ - rufen Sie uns an 030 / 120 11 352”

So I do not think it’s working properly.

I tried to create metadata to other pages on my site, as well as new sites. Nowhere my individual metadata show up, always the first lines of page contents are used for that.

Is it a bug? - Or just my misconfiguration ?

Greetings,
Wolf

What is the content of your usr/config/site.yaml file?
Try putting the metadata in there and check if it’s showing in sourcecode.

Hi, thanks for your care.
I have text in user/config/site.yaml-description: ‘mytexthere’, and it shows up in the source code, meta data analysis tools can find it and say Meta Description is “mytextthere”; but only after I altered “summary” to “false”.

But it is not the individual Meta Description text for that specific sub-page. I think this one should be there.

So what you’re saying is meta desctription is set the same for all pages and based on the site config setting or first para. In that case you would need to adjust or override the current page layout, or specify a new layout (may already exist) so the page in question pulls from the page meta where appropriate.

Allright. To me at the moment, it looks like an issue, I filed one here.

Please apologize in case it’s just a matter of setup of my site, in case please drop me a line how to fix that.

Try setting summary to false in your default.de.md page header…and all other subpages.

I tried like this - was it what you meant ?

In “default.de.md” at the very top I have:

summary: false
metadata:
    description ...
   etc. ...

When doing so, my page throws an error:

array_merge(): Argument #2 is not an array

In addition, I tried:

summary:
  enabled: false
metadata:
    description: 'Unser Service - Kofferrollen austauschen in Berlin, Nähe ZOB am Funkturm.

Herewith, I do not get an error, but again the general summary for the whole side, not the specific page.

Hm, not quite sure why it’s not working.
Did you indent correctly?
https://learn.getgrav.org/content/headers#standard-metatag-examples

You could also try putting metadata in frontmatter.yaml
https://learn.getgrav.org/content/headers#frontmatter-yaml

Thank you very much for your patience.
I’m quite certain to have intended correctly, as I copied the code from the documentation. It is quoted above, so you could check it.

I created a frontmatter.yaml in the directory where default.de.md lives with this content:

    generator: 'Super Grav'
    description: 'Give your page a powerup with Grav!'

as well as:

metadata:
    generator: 'Super Grav'
    description: Give your page a powerup with Grav!

Again, I only get the site-wide description.

Thanks to a fellow friend who wrote a PM to me, I found that deactivating the “Social & SEO
Meta tags” plugin leads close to the desired results. This plugin may contain a bug. We’re examining this at the moment.

TL;DR: It is a mix of issues caused by plugin and theme:

  • Plugin ‘Social & Seo Meta Tags’ falsely overlooks a ‘metadata:description’ definition in pages and generates a description based on the summary of page.
  • Theme Machine leads to a second issue with duplicate <meta name=“description”> tags.

Long read:

Looking at the observations of @herrdeh

  • First part of page content is being used as meta:description (Grav doesn’t do that).
  • Enabled/disabled summary having influence on the description.
  • It all works fine on my own fresh install.

… I got the feeling it has nothing to do with Grav itself, but possibly with a SEO plugin.

So I looked at some of the SEO plugins and found that TinySeo ignores the usual Grav frontmatter ‘metadata:description’ in pages.

OP appeared to be using plugin ‘Social & Seo Metatags’ instead. This plugin does check for the presence of ‘metadata:description’, but unfortunately it never finds it due to a bug.

After fixing the above, the description became a concatenation of the value of ‘metadata:description’ in the page and the value of ‘site:metadata:description’ in ‘site.yaml’

This is caused by theme Machine that includes two different <meta name=“description”> tags based on two different values.

Finally, meta tags work as intented…

If you want to know the required fixes:

1 Like