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

How to add multiple language URLs to the XML Sitemap generated by nuxt-simple-sitemap? #35

Closed
msfm360 opened this issue Apr 26, 2023 · 16 comments

Comments

@msfm360
Copy link

msfm360 commented Apr 26, 2023

Details

I am using nuxt-simple-sitemap for my website which has two languages, /en and /ar. However, the XML Sitemap generated by the tool only includes the default language URLs. Can someone please tell me how I can add the /en and /ar links to the XML Sitemap?

image

@msfm360
Copy link
Author

msfm360 commented Apr 26, 2023

@provok-it can you help me i saw your website have multilingual

@msfm360
Copy link
Author

msfm360 commented Apr 26, 2023

image

@provok-me
Copy link

The package is not working for me anymore since 2.4.8.

We should wait for @harlan-zw to resolve the issue first, then we'll see if you're really having a problem with it.

See #33.

@memic84
Copy link

memic84 commented Apr 28, 2023

Any idea if it's possible to add a sitemapindex, we've used the Nuxt 2 module, see their docs: https://sitemap.nuxtjs.org/usage/sitemap-index

@provok-me
Copy link

@memic84
Copy link

memic84 commented Apr 28, 2023

Yes, I read it several times and tried it, but failed to get it working. I have two dynamic sources, multiple languages and dont use the pages, and got it actually working with https://roe.dev/blog/creating-your-own-sitemap-module#a-different-approach-for-a-dynamic-sitemap

@harlan-zw
Copy link
Collaborator

Any idea if it's possible to add a sitemapindex, we've used the Nuxt 2 module, see their docs: https://sitemap.nuxtjs.org/usage/sitemap-index

It should be straight forward, for example in the playground I have this config and it works without issue.

    sitemaps: {
      posts: {
        include: ['/blog/**']
      },
      pages: {
        exclude: ['/blog/**'],
      }
    }

If you still have issues and would like some help please create a seperate issue.

@harlan-zw
Copy link
Collaborator

Details

I am using nuxt-simple-sitemap for my website which has two languages, /en and /ar. However, the XML Sitemap generated by the tool only includes the default language URLs. Can someone please tell me how I can add the /en and /ar links to the XML Sitemap?

image

If you're using the latest nuxt-simple-sitemap with the latest @nuxt/i18n this should just work for you. You'll need to provide some reproduction details if you want some further help.

@msfm360
Copy link
Author

msfm360 commented Apr 29, 2023

Details

I am using nuxt-simple-sitemap for my website which has two languages, /en and /ar. However, the XML Sitemap generated by the tool only includes the default language URLs. Can someone please tell me how I can add the /en and /ar links to the XML Sitemap?
image

If you're using the latest nuxt-simple-sitemap with the latest @nuxt/i18n this should just work for you. You'll need to provide some reproduction details if you want some further help.

I’m using the latest version , but I’m not sure what you mean by reproduction details.

image

image
image

@harlan-zw
Copy link
Collaborator

Do you build your site using nuxt build or nuxt generate? Also, it looks like you're modifying the sitemap output somehow with code you haven't shared.

Ideally, you would provide a Stackblitz reproduction so I can see exactly what the setup/issue is. You can make one using the starter https://stackblitz.com/edit/nuxt-starter-dyraxc?file=package.json

@msfm360
Copy link
Author

msfm360 commented Apr 30, 2023

Do you build your site using nuxt build or nuxt generate? Also, it looks like you're modifying the sitemap output somehow with code you haven't shared.

Ideally, you would provide a Stackblitz reproduction so I can see exactly what the setup/issue is. You can make one using the starter https://stackblitz.com/edit/nuxt-starter-dyraxc?file=package.json

thanks a lot i was using npm run build :|

now its just works fine

@msfm360 msfm360 closed this as completed Apr 30, 2023
@lisaschumann
Copy link

I hope it is ok to post on this thread here. I am struggling to generate the dynamic routes for each page and blog post for "/en/page" and "/de/page" and would love to see how you set this up.
I made a simple reproduction here: https://stackblitz.com/edit/nuxt-starter-uhq2jp?file=app.vue
I set the blog posts to be fetched from contentful, but here just using an array to keep it simple. Appreciate any lead you might be able to provide. I saw @provok-it also had the i18n routes working, but not sure what I am missing.

@provok-me
Copy link

@lisaschumann the Nitro prerender will generate all the internal links found from the "/"route.

In the sandbox env you made there is no <NuxtLink /> tag, thus no dynamic url in your sitemap.

@lisaschumann
Copy link

lisaschumann commented May 9, 2023

@provok-it sorry I think I am not quite understanding. I moved the nav to the index page, but that's probably not what you meant. In my build I set up the nav with to the different pages and then on the blog pages it is showing a grid of all the articles. I would like all pages as well as dynamically fetched articles to be pulled through not only as the original "/{{pagename}}" for the English version but also "/de/{{pagename}}" for the German version. I think I am missing something on the basic set-up understanding. Do you know of a viewable example of the i18n setup with the sitemap online?

@harlan-zw
Copy link
Collaborator

Hey @lisaschumann

Would you be able to create a new issue the reproduction you created and I'll look at it when I have a chance :)

@lisaschumann
Copy link

Hey @harlan-zw really appreciate it. A bit of a hectic week, so will put it together now and open a new issue!

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

5 participants