1

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?

John Conde
  • 217,595
  • 99
  • 455
  • 496
Pippi
  • 313
  • 1
  • 4
  • 18

1 Answers1

1

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.

Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49
  • i've see webpack.common.js, there is yet present configuration for robot.txt but if i go on mysite.com/robot.txt it return 404... – Pippi Jun 24 '20 at 13:08
  • Just checking it's robots.txt with an "s" not robot.txt. Have you run a prod build to check that the file has been bundled into your executable jar? – Gaël Marziou Jun 24 '20 at 13:34