skip to Main Content

I have setup an AngularJS application which is using ui-state router. It has some static pages and other than that it has profile pages which generate dynamic page based on profile id.

For SEO purpose I have used PhantomJS and generate HTMLs to give crawler response.

But, How can I generate sitemap.xml which contains all the dynamic pages URL and by that crawler can fetch and list on search engine?

2

Answers


  1. Using JavaScript

    You can use XMLWriter to create an XML. Then you can pass this XML as a string to your web server. Check this out for XML Writer.

    Here is a tutorial for the available methods for writing an XML using XMLWriter – Tutorial

    Using Nodejs

    You can write a node js function for generating the sitemap from the generated URLs. Please refer to this link for a sample.

    The better way is to create a script in the backend to generate it periodically to update sitemaps. Query the tables, create URLs and generate XML files. You can configure cron jobs in the server to generate the sitemaps periodically.

    There will be libraries and tutorials available for each BE technology for generating the sitemap.

    For example:

    Ruby on RailsNokogiri
    Elixirsitemap
    .NetTutorial
    JavaTutorial
    Express JSexpress-sitemap

    Login or Signup to reply.
  2. Simple, You need to generate online Sitemap that creates all dynamic URLs.
    Just Search Online Sitemap Generator. put your Website URL and it creates the Sitemap.XML file, You need to download that file and upload in your server.

    after that check that Sitemap using http://www.mydomain.com/sitemap.xml

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