8000 What about localized pages? · Issue #53 · bartholomej/svelte-sitemap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
What about localized pages? #53
Open
@Shackless

Description

@Shackless

Hi, great project!

I have one question though: According to the Google Docs, you should specify alternate languages for each page in a single <url> node like this:

<url>
    <loc>https://www.example.com/en/page.html</loc>
    <xhtml:link
               rel="alternate"
               hreflang="de"
               href="https://www.example.com/de/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="en"
               href="https://www.example.com/en/page.html"/>
  </url>

Currently, the generator obviously just walks through the generated files, to it will be something like:

 <url>
  <loc>https://www.example.com/en/page.html</loc>
</url>
<url>
  <loc>https://www.example.com/de/page.html</loc>
</url>

This will result in a heavy SEO penalty because the pages will be detected as duplicates and also Google won't be able to preview the correct language, nor will it be able to auto-redirect to the localized pages. The fact that both entries do not have any hreflang attribute makes things even worse in terms of SEO.

I know this is hard to do if you just walk the build output tree. If people are using localized URLs, it will be impossible to restore the connections between pages just based on the build output.
Also given #44 and #48, it might be better to add some kind of config for the sitemap to page.server.ts files and read those when building the sitemap to retrieve the required meta data. You can also walk the /src directory. This way, we could configure sitemap entries per page. You'd have to somehow call the EntryGenerator function, to retrieve available route params like [slug] etc. but on prerendered pages, people have already implemented that anyways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0