Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related items not grouped in sitemap #92

Open
marcocevoli opened this issue Feb 9, 2021 · 5 comments
Open

Related items not grouped in sitemap #92

marcocevoli opened this issue Feb 9, 2021 · 5 comments

Comments

@marcocevoli
Copy link

I've noticed that in v. 3.0 many pages are listed separately even though they belong to the same Grav page. See "politica-cookies", for instance (https://qabiria.com/politica-cookie): I have a single folder named "politica-cookie" with 3 files inside, default.en.md, default.it.md, default.es.md, where EN and ES are translations of the Italian file. They have a different slug, because - following best practices - I have translated all URLs.

I would expect 3 different elements in the sitemap, with cross-referenced rel="alternate" entries, but, instead, I do have 3 different but there is no relation between each other.

Is this an issue with the sitemap plugin or with Grav multilingual features?

@Karmalakas
Copy link

Just checked and same on my sitemap. Looks like a bug, because in Google SEO recommendations example shows 3 pages <url>s each having 3 alternate links

@rhukster rhukster added the bug label Feb 18, 2021
@rhukster
Copy link
Member

Does look like a bug on your sitemaps.. I can't seem to replicate this on my own setups, so perhaps can one of put together a small sample set of 'pages' that exhibits this behavior so I can reproduce and fix?

@Karmalakas
Copy link

Karmalakas commented Jun 23, 2021

Finally got to it 😅 So...

# site.yaml
default_lang: lt
# system.yaml
languages:
  supported:
    - lt
    - en
  default_lang: lt
  include_default_lang: false
  include_default_lang_file_extension: true
  override_locale: true
  content_fallback:
    en: en
  pages_fallback_only: true

Pages structure

/pages
  '- 02.typography
    |- default.en.md
    '- default.lt.md

Currently I have similar to this (removed last modified, priority and other tags for clarity):

  <url>
    <loc>http://playground.local/tipografija</loc>
    <xhtml:link rel="alternate" hreflang="lt" href="http://playground.local/tipografija" />
    <xhtml:link rel="alternate" hreflang="x-default" href="http://playground.local/tipografija" />
  </url>
  <url>
    <loc>http://playground.local/en/typography</loc>
    <xhtml:link rel="alternate" hreflang="en" href="http://playground.local/en/typography" />
  </url>

I expect sitemap to be something like this:

  <url>
    <loc>http://playground.local/tipografija</loc>
    <xhtml:link rel="alternate" hreflang="lt" href="http://playground.local/tipografija" />
    <xhtml:link rel="alternate" hreflang="en" href="http://playground.local/en/typography" />
  </url>
  <url>
    <loc>http://playground.local/en/typography</loc>
    <xhtml:link rel="alternate" hreflang="lt" href="http://playground.local/tipografija" />
    <xhtml:link rel="alternate" hreflang="en" href="http://playground.local/en/typography" />
  </url>

See this example on Google

@splitbrain
Copy link

FWIW here's my config:

languages:
  supported:
    - de
    - en
  default_lang: de
  include_default_lang: true
  include_default_lang_file_extension: true
  content_fallback:
    en: ['de']
    de: ['en']
  languages:
    http_accept_language: true

I have a page /legal/10.impressum/ with a default.de.md and a default.en.md. The latter has slug: imprint in the frontmatter.

In my sitemap I find two entries:

<url>
    <loc>http://localhost/cchp/de/legal/impressum</loc>
      <xhtml:link rel="alternate" hreflang="de" href="http://localhost/cchp/de/legal/impressum" />
      <xhtml:link rel="alternate" hreflang="x-default" href="http://localhost/cchp/de/legal/impressum" />
        <lastmod>2021-08-25</lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
      </url>
<url>
    <loc>http://localhost/cchp/en/legal/imprint</loc>
      <xhtml:link rel="alternate" hreflang="en" href="http://localhost/cchp/en/legal/imprint" />
        <lastmod>2021-08-25</lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
      </url>

@msa2020user
Copy link

Hello, same problem here... Has anyone found a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants