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

Docs: localized sitemap example is broken #63764

Closed
FelDev opened this issue Mar 27, 2024 · 6 comments
Closed

Docs: localized sitemap example is broken #63764

FelDev opened this issue Mar 27, 2024 · 6 comments
Labels
Documentation Related to Next.js' official documentation. locked

Comments

@FelDev
Copy link

FelDev commented Mar 27, 2024

What is the improvement or update you wish to see?

https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap#generate-a-localized-sitemap

The localized sitemap example looks like this

import { MetadataRoute } from 'next'
 
export default function sitemap(): MetadataRoute.Sitemap {
  return [
    {
      url: 'https://acme.com',
      lastModified: new Date(),
      alternates: {
        languages: {
          es: 'https://acme.com/es',
          de: 'https://acme.com/de',
        },
      },
    },
    {
      url: 'https://acme.com/about',
      lastModified: new Date(),
      alternates: {
        languages: {
          es: 'https://acme.com/es/about',
          de: 'https://acme.com/de/about',
        },
      },
    },
    {
      url: 'https://acme.com/blog',
      lastModified: new Date(),
      alternates: {
        languages: {
          es: 'https://acme.com/es/blog',
          de: 'https://acme.com/de/blog',
        },
      },
    },
  ]
}

If I copy paste that example, it doesn't work.

Object literal may only specify known properties, and 'alternates' does not exist in type '{ url: string; lastModified?: string | Date | undefined; changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined; priority?: number | undefined; }'
Screenshot 2024-03-27 at 09 34 36

Also, when selecting "javascript" instead of "typescript", the example disapears.

Screenshot 2024-03-27 at 09 36 20

Is there any context that might help us understand?

I literally copy pasted the example from the docs.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap#generate-a-localized-sitemap

@FelDev FelDev added the Documentation Related to Next.js' official documentation. label Mar 27, 2024
@canisminor1990

This comment has been minimized.

@seob171
Copy link

seob171 commented Mar 28, 2024

you have to upgrade next.js version

https://github.com/vercel/next.js/releases/tag/v14.2.0-canary.34

@balazsorban44
Copy link
Member

Closing as per #63764 (comment), which is the correct answer to this issue.

@Almuhanad-1
Copy link

Almuhanad-1 commented Apr 2, 2024

you have to upgrade next.js version

https://github.com/vercel/next.js/releases/tag/v14.2.0-canary.34

how to prevent dependency conflicts after updating to "next": "^14.2.0-canary.52"?
I get conflicts with "@next/third-parties" and "next-intl"

`
Found: next@14.2.0-canary.52

npm ERR! node_modules/next

npm ERR! next@"^14.2.0-canary.52" from the root project

npm ERR!

npm ERR! Could not resolve dependency:

npm ERR! peer next@"^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0" from next-intl@3.10.0

npm ERR! node_modules/next-intl

npm ERR! next-intl@"3.10.0" from the root project
`

@abdullahzt
Copy link

abdullahzt commented Apr 11, 2024

@Almuhanad-1

You need to override the dependency for those packages

  "overrides": {
    "next-intl": {
      "next": "14.2.0-canary.34"
    },
    "@next/third-parties": {
      "next": "14.2.0-canary.34"
    }
  },

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Related to Next.js' official documentation. locked
Projects
None yet
Development

No branches or pull requests

6 participants