question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating dynamic URLs

See original GitHub issue

Hello there,

We are using Next 9.3 and when I run my server with this code

const sitemap = require('nextjs-sitemap-generator');

sitemap({
  baseUrl: 'https://scale.com',
  ignoredPaths: ['admin'],
  pagesDirectory: __dirname + "/pages",
  targetDirectory : __dirname + '/public/static/',
  nextConfigPath: __dirname + "/next.config.js",
  ignoredExtensions: [
        'png',
        'jpg'
  ],
  pagesConfig: {
    '/login': {
      priority: '0.5',
      changefreq: 'daily'
    }
  }
});

I can’t get the dynamic urls generated

<lastmod>2020-04-16</lastmod>
                </url><url><loc>https://scale.com/legal/[slug]</loc>

Thank you very much!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

11reactions
IlusionDevcommented, Apr 23, 2020

Well, I didn’t see that. I’m going to see all the docs and make a decision about the new integration

6reactions
andrew-mecommented, Jul 29, 2022

I managed to get dynamic paths working without exportPathMap. Rough code following, hopefully it’s helpful:

const { getIds } = require('./src/api/getIds');

async function getStaticPaths() {
    const ids = await getIds();
    return ids.map((id) => `/somewhere/${id}`);
}

getStaticPaths()
    .then((paths) => {
        sitemap({
            ...
            extraPaths: paths,
            ...
        });

        console.log(`✅ sitemap.xml generated!`);
    })
    .catch((error) => {
        throw new Error('Error generating sitemap: ' + error.message);
    });

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create Dynamic Links - Firebase
Using the Dynamic Link Builder API on iOS, Android, and Flutter. This is the preferred way to dynamically create links in your app...
Read more >
Generating dynamic URLs in Flask - GeeksforGeeks
Generating dynamic URLs in Flask · Dynamic Routing: It is the process of getting dynamic data(variable names) in the URL and then using...
Read more >
Dynamic URLs vs. static URLs | Google Search Central Blog
What is a dynamic URL? ... If the content of a site is stored in a database and pulled for display on pages...
Read more >
Generate URL for dynamic webpage - Stack Overflow
The url generated will then be like http://www.example.com/customvideo/10010 The url sees the "10010" part, looks up the folder, gets the json ...
Read more >
Create a Dynamic Link - Firebase Help - Google Support
Click New dynamic link. Enter at least a Link name and Link URL. Optionally, enter advanced information about your link. Click Create link....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found