Search code examples
angularweb-applicationsjhipsterrobots.txtxml-sitemap

Add sitemap on application based on jhipster


I'm working with application generated with Jhipster.

I want add sitemap.xml and robot.txt but follow the angular conventions it seems not working.

I've created robot.txt and sitemap.xml under "src/main/webapp/".

in my angular.json file i've added

 "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "assets": [
              "src/main/webapp/robots.txt",
              "src/main/webapp/sitemap.xml"
            ],
            "scripts": []
          }
        }
      }

how mentioned in angular docs

When i start application i not see sitemap.xml on localhost:8080/sitemap.xml not even in localhost:8080/main/webapp/robots.txt.

Anyone can help me?


Solution

  • JHipster does not (yet) fully support Angular CLI, so your changes in angular.json are not taken into account.

    You need to modify the webpack configuration in webpack/webpack.common.js to copy sitemap.xml like what is already done for robots.txt.

    By the way, robots.txt is already generated so you don't have to create it, just modify it.