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

Multilanguage sets unpublished pages as alternates #43

Closed
redrohX opened this issue May 3, 2017 · 3 comments
Closed

Multilanguage sets unpublished pages as alternates #43

redrohX opened this issue May 3, 2017 · 3 comments

Comments

@redrohX
Copy link

redrohX commented May 3, 2017

So I have a lot of multilanguage pages, but for quite a lot of them the parent language is set to published: false. What I do see in my sitemap.xml is that these pages are still included there (and generate a 404). What I expect is that pages which are not published don't end up as alternates in the sitemap.xml.

Current situation where the EN version is set to published: false.

<url>
    <loc>http://www.md.dev/nl-nl/blog/blog-post-in-dutch</loc>
    <xhtml:link rel="alternate" hreflang="en" href="http://www.md.dev/blog/blog-post-in-dutch" />
    <xhtml:link rel="alternate" hreflang="nl-nl" href="http://www.md.dev/nl-nl/blog/blog-post-in-dutch" />
    <lastmod>2017-05-03</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>

What I expect to happen:

<url>
    <loc>http://www.md.dev/nl-nl/blog/blog-post-in-dutch</loc>
    <xhtml:link rel="alternate" hreflang="nl-nl" href="http://www.md.dev/nl-nl/blog/blog-post-in-dutch" />
    <lastmod>2017-05-03</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>

Also I'm not 100% sure if it should set rel="alternate" if there is only one URL (and I guess no alternates). But I do expect the unpublished page not to be there.

@flaviocopes
Copy link
Contributor

Strange, I tried and when I set published: false an a translation of the page, the alternate disappears.

@redrohX
Copy link
Author

redrohX commented May 17, 2017

That's odd. What I get back from $page->translatedLanguages() in sitemap.php are all the local pages if they exist. There doesn't seem to be a check for published: true.

So just to be clear. My default language is en. Then I have nl-nl, fr-fr and en-gb.
This is the structure:

/page-title
   blog-post.de-de.md <-- published: false
   blog-post.en.md <-- published: true
   blog-post.nl-nl.md <-- published: false

What I see in my sitemap.xml for the default language on md.dev/sitemap.xml:

<url>
    <loc>http://www.md.dev/blog/page-title</loc>
    <xhtml:link rel="alternate" hreflang="en" href="http://www.md.dev/blog/page-title" />
    <xhtml:link rel="alternate" hreflang="nl-nl" href="http://www.md.dev/nl-nl/blog/page-title" />
    <xhtml:link rel="alternate" hreflang="de-de" href="http://www.md.dev/de-de/blog/page-title" />
    <lastmod>2017-05-16</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>

Yes the page is not available in the sitemap for nl-nl, but it already shouldn't be visible as alternate for the default language either.

Is there something I'm missing here?

@flaviocopes
Copy link
Contributor

I tested it again, but I cannot replicate the problem. Maybe send me your user/ folder on Slack so I can replicate on your same page structure and config.

flaviocopes added a commit to getgrav/grav that referenced this issue May 19, 2017
…ranslated list (#1482)

* Remove unpublished pages from the translated languages, move into untranslated list

Refs getgrav/grav-plugin-sitemap#43

* Add missing part

* Add flags to avoid breaking changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants