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

Meta: description does not show up

Solved by pamtbaau View solution

Started by Wolf 7 years ago · 16 replies · 2405 views
7 years ago

Hello,

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

default.de.md starts as follows:

YAML

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
last edited 01/28/19 by Wolf
7 years ago

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

7 years ago

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

This is what the first few lines say:

TWIG
<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?

last edited 01/28/19 by Wolf
7 years ago

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.

7 years ago

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.

7 years ago

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

7 years ago

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.

last edited 01/24/19 by arank
7 years ago

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.

7 years ago

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.

7 years ago

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.

7 years ago

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

7 years ago

I tried like this - was it what you meant ?

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

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

When doing so, my page throws an error:

TXT
array_merge(): Argument #2 is not an array
last edited 01/28/19 by Wolf
7 years ago

In addition, I tried:

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

last edited 01/28/19 by Wolf
7 years ago

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:

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

as well as:

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

Again, I only get the site-wide description.

last edited 01/28/19 by Wolf
7 years ago

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.

7 years ago Solution

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
last edited 01/28/19 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 53 10 hours ago
Support · by Anna, 3 days ago
2 60 13 hours ago
Support · by Justin Young, 14 hours ago
1 30 14 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago