Angular 在基于jhipster的应用程序上添加站点地图
我正在使用Jhipster生成的应用程序 我想添加sitemap.xml和robot.txt,但按照角度惯例,它似乎不起作用 我已经在“src/main/webapp/”下创建了robot.txt和sitemap.xml 在我的angular.json文件中,我添加了Angular 在基于jhipster的应用程序上添加站点地图,angular,web-applications,jhipster,robots.txt,xml-sitemap,Angular,Web Applications,Jhipster,Robots.txt,Xml Sitemap,我正在使用Jhipster生成的应用程序 我想添加sitemap.xml和robot.txt,但按照角度惯例,它似乎不起作用 我已经在“src/main/webapp/”下创建了robot.txt和sitemap.xml 在我的angular.json文件中,我添加了 "architect": { "build": { "builder": "@angular-devkit/build-a
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"assets": [
"src/main/webapp/robots.txt",
"src/main/webapp/sitemap.xml"
],
"scripts": []
}
}
}
如何在中提到
启动应用程序时,我在localhost:8080/sitemap.xml上看不到sitemap.xml,甚至在localhost:8080/main/webapp/robots.txt中也看不到
有人能帮我吗?JHipster(还)不完全支持Angular CLI,因此您在Angular.json
中所做的更改不会被考虑在内
您需要在webpack/webpack.common.js
中修改webpack配置,以复制sitemap.xml
,就像对robots.txt
所做的那样
顺便说一句,
robots.txt
已经生成,所以您不必创建它,只需修改它。我已经看到webpack.common.js,robot.txt的当前配置,但如果我在mysite.com/robot.txt上运行,它将返回404…只需用“s”而不是robot.txt检查它是robots.txt。您是否运行了prod构建来检查文件是否已绑定到可执行jar中?