skip to Main Content

We have an app where the Admin adds events dynamically.

Let’s say our event has a URL : abc.com/100/Rishikesh-Retreat or abc.com/100/Mumbai-Retreat

Now, my query is how Google will index these dynamic pages. Shall I update my sitemap.xml every 24 hours using cron job and then shall I ask Google to crawl the site manually? Can we automate the part where we ask Google to crawl our website once the sitemap is updated?

We are using React and have a simple Node Server that serves the site and updates the metadata tags.

We were planning to move to Next JS if it helps with SEO for dynamic pages.

Our aim is that the dynamic pages should get indexed and when we search for them the results should appear on the first page.

2

Answers


  1. from next sitemap docs

    Good to know: sitemap.js is a special Route Handlers that is cached by
    default unless it uses a dynamic function or dynamic config option.

    if you add sitemap.ts in your app directory and run npm run build, it will create a static route

    enter image description here

    This means when you visit your sitemap url http://localhost:3000/sitemap.xml sitemap special route handler will be called. you probably have seen creating dynamic sitemap code. For example from here

    // app/sitemap.js
    
    import { getSortedPostsData } from "../lib/posts";
    
    const URL = "https://claritydev.net";
    
    export default async function sitemap() {
      const posts = getSortedPostsData.map(({ id, date }) => ({
        url: `${URL}/blog/${id}`,
        lastModified: date,
      }));
    
      const routes = ["", "/portfolio", "/blog"].map((route) => ({
        url: `${URL}${route}`,
        lastModified: new Date().toISOString(),
      }));
    
      return [...routes, ...posts];
    }
    

    With those being sad, everytime your sitemap url is called you have to make sure sitemap() cache gets invalidated and you make a fresh sitemap() call. I did not test this but if you try to add this on top of "app/sitemap.js"

     export const dynamic = 'force-dynamic'
    

    after this setting, if you rebuild your app, /sitemap will be dynamic:

    enter image description here

    Login or Signup to reply.
  2. You should make create html file dynamically by the admin side where admin will write all the meta data and add the things which you provide and after submission its html file will be created and that will be good for indexing.

    But if you create your website in Next.js and when admin create any event, you have to build your next.js project and that static files will be created by using generatestaticparams so whenever admin adds another event you have to build your project and then upload it your server

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search