From b7a5270c1026aecb22722772d6dbe04f923a2b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=9A=82=E8=9A=81=E4=BA=91?= Date: Sun, 18 Oct 2026 21:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomayi/web/config/MyWebMvcConfig.java | 8 +- .../web/controller/GoodsController.java | 9 +- .../web/controller/IndexController.java | 3 +- .../web/controller/PaymentController.java | 2 +- .../web/controller/UserController.java | 7 +- .../src/main/resources/application.yml | 7 ++ .../main/resources/static/assets/css/main.css | 49 +++++++++- .../main/resources/static/assets/js/common.js | 5 + .../src/main/resources/static/llms.txt | 47 +++++++++ .../src/main/resources/static/robots.txt | 32 +++++++ .../src/main/resources/static/sitemap.xml | 33 +++++++ .../src/main/resources/templates/403.html | 2 +- .../src/main/resources/templates/404.html | 2 +- .../main/resources/templates/book/index.html | 4 +- .../main/resources/templates/copyright.html | 4 +- .../src/main/resources/templates/forget.html | 4 +- .../main/resources/templates/goods/buy.html | 4 +- .../resources/templates/goods/detail.html | 4 +- .../src/main/resources/templates/index.html | 86 +++++++++++++++-- .../src/main/resources/templates/index2.html | 4 +- .../src/main/resources/templates/index3.html | 84 ++++++++++++++-- .../src/main/resources/templates/login.html | 4 +- .../src/main/resources/templates/login2.html | 4 +- .../main/resources/templates/order/pay.html | 2 +- .../resources/templates/order/pay_wx.html | 2 +- .../resources/templates/order/pay_wx2.html | 2 +- .../resources/templates/plugin/index.html | 4 +- .../resources/templates/product/index.html | 4 +- .../templates/public/common_header.html | 10 +- .../resources/templates/public/footer.html | 18 +++- .../resources/templates/public/header.html | 95 ++++++++++++------- .../main/resources/templates/register.html | 4 +- .../resources/templates/service/index.html | 4 +- .../main/resources/templates/user/coupon.html | 4 +- .../main/resources/templates/user/info.html | 4 +- .../main/resources/templates/user/order.html | 4 +- .../resources/templates/user/password.html | 2 +- 37 files changed, 462 insertions(+), 105 deletions(-) create mode 100644 xiaomayi-modules/xiaomayi-web/src/main/resources/static/llms.txt create mode 100644 xiaomayi-modules/xiaomayi-web/src/main/resources/static/robots.txt create mode 100644 xiaomayi-modules/xiaomayi-web/src/main/resources/static/sitemap.xml diff --git a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/config/MyWebMvcConfig.java b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/config/MyWebMvcConfig.java index ed66935..7f2209a 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/config/MyWebMvcConfig.java +++ b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/config/MyWebMvcConfig.java @@ -60,7 +60,9 @@ public class MyWebMvcConfig implements WebMvcConfigurer { .excludePathPatterns("/wxpay/updateWxOrder") .excludePathPatterns("/alipay/alipayNotify") .excludePathPatterns("/alipay/updateAlipayOrder") - .excludePathPatterns("/auth/**"); + .excludePathPatterns("/auth/**") + // SEO/GEO 爬虫文件放行 + .excludePathPatterns("/robots.txt", "/sitemap.xml", "/llms.txt"); // 多租户拦截器 registry.addInterceptor(tenantInterceptor) @@ -79,5 +81,9 @@ public class MyWebMvcConfig implements WebMvcConfigurer { // 当输入域名是可以自动跳转到默认指定的网页,可以配置动态参数 // registry.addViewController("/").setViewName("forward:" + indexUrl); registry.addViewController("/favicon.ico").setViewName("forward:/static/favicon.ico"); + // SEO/GEO 爬虫文件按惯例须在站点根路径(robots.txt 不会去抓 /static/robots.txt) + registry.addViewController("/robots.txt").setViewName("forward:/static/robots.txt"); + registry.addViewController("/sitemap.xml").setViewName("forward:/static/sitemap.xml"); + registry.addViewController("/llms.txt").setViewName("forward:/static/llms.txt"); } } diff --git a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/GoodsController.java b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/GoodsController.java index 470f700..012ea9b 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/GoodsController.java +++ b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/GoodsController.java @@ -1,6 +1,5 @@ package com.xiaomayi.web.controller; -import com.xiaomayi.core.config.AppConfig; import com.xiaomayi.core.utils.StringUtils; import com.xiaomayi.member.service.MemberCouponService; import com.xiaomayi.member.vo.membercoupon.MemberCouponVO; @@ -61,6 +60,12 @@ public class GoodsController extends BaseController { model.addAttribute("product", product); // 网站标题 model.addAttribute("title", product.getProductTitle()); + // 页面描述(SEO,去除简介中的HTML标签) + if (StringUtils.isNotNull(product.getProductDesc())) { + model.addAttribute("desc", product.getProductDesc().replaceAll("<[^>]*>", "").trim()); + } + // 规范链接(SEO) + model.addAttribute("canonical", "https://www.djangoadmin.cn/goods/detail/" + id); } // 商品规格 @@ -94,7 +99,7 @@ public class GoodsController extends BaseController { @GetMapping("/buy/{productId}/{specName}/{validName}") public String buy(@PathVariable("productId") Integer productId, @PathVariable("specName") String specName, @PathVariable("validName") String validName, Model model) { // 网站标题 - model.addAttribute("title", String.format("订单确认 - %s", AppConfig.getName())); + model.addAttribute("title", "订单确认"); // 商品信息 Product product = productService.getInfo(productId); if (StringUtils.isNotNull(product)) { diff --git a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/IndexController.java b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/IndexController.java index 5962ac1..ba2a684 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/IndexController.java +++ b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/IndexController.java @@ -1,6 +1,5 @@ package com.xiaomayi.web.controller; -import com.xiaomayi.core.config.AppConfig; import com.xiaomayi.core.utils.R; import com.xiaomayi.email.annotation.EmailLog; import com.xiaomayi.email.enums.EmailType; @@ -77,7 +76,7 @@ public class IndexController extends BaseController { @GetMapping("/copyright") public String copyright(Model model) { // 网站标题 - model.addAttribute("title", String.format("版权说明 - %s", AppConfig.getName())); + model.addAttribute("title", "版权说明"); return ModelViewEnum.COPYRIGHT_HTML.getValue(); } diff --git a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/PaymentController.java b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/PaymentController.java index 731dedb..4933b23 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/PaymentController.java +++ b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/PaymentController.java @@ -104,7 +104,7 @@ public class PaymentController extends BaseController { // 付款二维码地址(有效期2个小时) order.setCodeUrl(result.get("code_url")); model.addAttribute("order", order); - model.addAttribute("title", "微信支付 - 收银台"); + model.addAttribute("title", "微信支付收银台"); return ModelViewEnum.WEIXIN_PAYMENT_HTML.getValue(); } return "404"; diff --git a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/UserController.java b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/UserController.java index 59778ad..98041bb 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/UserController.java +++ b/xiaomayi-modules/xiaomayi-web/src/main/java/com/xiaomayi/web/controller/UserController.java @@ -1,6 +1,5 @@ package com.xiaomayi.web.controller; -import com.xiaomayi.core.config.AppConfig; import com.xiaomayi.core.utils.R; import com.xiaomayi.member.dto.member.MemberCheckSmsDTO; import com.xiaomayi.member.dto.member.MemberInfoUpdateDTO; @@ -48,7 +47,7 @@ public class UserController extends BaseController { @GetMapping("/order") public String order(Model model) { // 网站标题 - model.addAttribute("title", String.format("我的订单 - %s", AppConfig.getName())); + model.addAttribute("title", "我的订单"); return ModelViewEnum.ORDER_LIST_HTML.getValue(); } @@ -62,7 +61,7 @@ public class UserController extends BaseController { @GetMapping("/coupon") public String coupon(Model model) { // 网站标题 - model.addAttribute("title", String.format("我的优惠券 - %s", AppConfig.getName())); + model.addAttribute("title", "我的优惠券"); // 获取待使用优惠券 List couponUserList = memberCouponService.getCouponList(MemberUtils.getMemberId(), 0); // 获取已使用优惠券 @@ -85,7 +84,7 @@ public class UserController extends BaseController { @GetMapping("/info") public String info(Model model) { // 网站标题 - model.addAttribute("title", String.format("个人信息 - %s", AppConfig.getName())); + model.addAttribute("title", "个人信息"); return ModelViewEnum.USER_INFO_HTML.getValue(); } diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/application.yml b/xiaomayi-modules/xiaomayi-web/src/main/resources/application.yml index 1f276c5..aafca5d 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/application.yml +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/application.yml @@ -53,3 +53,10 @@ spring: #exclude: WEB-INF/**,static/** # 监控额外的路径(优先于exclude) #additional-paths: src/main/java + +# 服务配置(与各环境 application-.yml 中的 server 配置合并) +server: + servlet: + # 会话跟踪仅使用 Cookie,禁用 URL 重写,避免静态资源 URL 携带 ;jsessionid(利于 SEO 与缓存) + session: + tracking-modes: cookie diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/css/main.css b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/css/main.css index 93a267b..0cf2929 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/css/main.css +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/css/main.css @@ -947,6 +947,15 @@ body .layui-util-face .layui-layer-content { display: inline-block } +.ew-footer p .footer-brand-icon { + width: 20px; + height: 20px; + fill: rgba(255, 255, 255, 0.4); + vertical-align: middle; + margin-right: 10px; + display: inline-block +} + .ew-footer p.img-group { position: relative; padding-left: 150px; @@ -965,7 +974,45 @@ body .layui-util-face .layui-layer-content { } .ew-footer .footer-copyright { - padding-top: 10px + padding-top: 10px; + clear: both +} + +/* 首页常见问题区块 */ +.faq-row { + display: flex; + flex-wrap: wrap +} + +.faq-row > .layui-col-md6 { + display: flex +} + +.faq-item { + background: #f8f9fb; + border-radius: 6px; + padding: 25px 30px; + margin-bottom: 30px; + flex: 1; + box-sizing: border-box +} + +.faq-item h3 { + font-size: 17px; + font-weight: 600; + color: #333; + margin: 18px 0 8px +} + +.faq-item h3:first-child { + margin-top: 0 +} + +.faq-item p { + color: #666; + font-size: 14px; + line-height: 28px; + margin: 0 } .ew-banner { diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/js/common.js b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/js/common.js index fb2b333..e543109 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/js/common.js +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/assets/js/common.js @@ -14,6 +14,11 @@ layui.config({ navIds.push($(this).attr('nav-id')); }); + // 导航链接保留 href 供 SEO/爬虫发现内链,点击仍由 lay-href 逻辑(平滑滚动/页面跳转)接管 + $(document).on('click', '.ew-header a[lay-href]', function (e) { + e.preventDefault(); + }); + // 导航点击事件 element.on('nav(ew-header-nav)', function (elem) { var layHref = $(elem).attr('lay-href'); diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/llms.txt b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/llms.txt new file mode 100644 index 0000000..be00ddb --- /dev/null +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/llms.txt @@ -0,0 +1,47 @@ +# DjangoAdmin + +> DjangoAdmin 是小蚂蚁云研发团队打造的企业级后台管理系统与敏捷开发框架,前后端分离、开箱即用,帮助企业和开发者快速构建中大型后台应用。 + +官网: https://www.djangoadmin.cn +官方邮箱: djangoadmin@126.com +研发团队: 小蚂蚁云研发团队 +Gitee 仓库: https://gitee.com/djangoadmin +GitHub 仓库: https://github.com/djangoadmin + +## 核心能力 + +- 后端基于 Python 生态,提供 Django、Flask、FastAPI、Tornado 四种框架版本 +- 前端集成 Layui、ElementPlus、AntDesign、NaiveUI 等主流 UI 组件库 +- 前后端分离架构,集成 RBAC 权限体系、多租户、代码生成器、工作流等企业级功能 +- 支持 MySQL、PostgreSQL、SqlServer、Oracle、Sqlite 等多种数据库驱动 + +## 主要页面 + +- [首页](https://www.djangoadmin.cn/): 产品概览、框架优势、价格与选择指南 +- [ElementPlus 版](https://www.djangoadmin.cn/goods/detail/2): DjangoAdmin 前后端分离框架 ElementPlus 版本 +- [AntDesign 版](https://www.djangoadmin.cn/goods/detail/3): DjangoAdmin 前后端分离框架 AntDesign 版本 +- [NaiveUI 版](https://www.djangoadmin.cn/goods/detail/4): DjangoAdmin 前后端分离框架 NaiveUI 版本 +- [版权说明](https://www.djangoadmin.cn/copyright): 许可与版权声明 + +## 源码仓库 + +- [Gitee 仓库](https://gitee.com/djangoadmin): 国内用户首选,含 Issues 与更新动态 +- [GitHub 仓库](https://github.com/djangoadmin): 国际镜像仓库 + +## 开发文档 + +- Django: http://docs.django.layui.djangoadmin.cn (Layui混编)、http://docs.django.elevue.djangoadmin.cn (ElementPlus)、http://docs.django.antdvue.djangoadmin.cn (AntDesign)、http://docs.django.naivevue.djangoadmin.cn (NaiveUI) +- Flask: http://docs.flask.layui.djangoadmin.cn (Layui混编)、http://docs.flask.elevue.djangoadmin.cn (ElementPlus)、http://docs.flask.antdvue.djangoadmin.cn (AntDesign)、http://docs.flask.naivevue.djangoadmin.cn (NaiveUI) +- FastAPI: http://docs.fastapi.layui.djangoadmin.cn (Layui混编)、http://docs.fastapi.elevue.djangoadmin.cn (ElementPlus)、http://docs.fastapi.antdvue.djangoadmin.cn (AntDesign)、http://docs.fastapi.naivevue.djangoadmin.cn (NaiveUI) +- Tornado: http://docs.tornado.layui.djangoadmin.cn (Layui混编)、http://docs.tornado.elevue.djangoadmin.cn (ElementPlus)、http://docs.tornado.antdvue.djangoadmin.cn (AntDesign)、http://docs.tornado.naivevue.djangoadmin.cn (NaiveUI) + +## 在线演示 + +- Django: http://manage.django.layui.djangoadmin.cn (Layui混编)、http://manage.django.elevue.djangoadmin.cn (ElementPlus)、http://manage.django.antdvue.djangoadmin.cn (AntDesign)、http://manage.django.naivevue.djangoadmin.cn (NaiveUI) +- Flask: http://manage.flask.layui.djangoadmin.cn (Layui混编)、http://manage.flask.elevue.djangoadmin.cn (ElementPlus)、http://manage.flask.antdvue.djangoadmin.cn (AntDesign)、http://manage.flask.naivevue.djangoadmin.cn (NaiveUI) +- FastAPI: http://manage.fastapi.layui.djangoadmin.cn (Layui混编)、http://manage.fastapi.elevue.djangoadmin.cn (ElementPlus)、http://manage.fastapi.antdvue.djangoadmin.cn (AntDesign)、http://manage.fastapi.naivevue.djangoadmin.cn (NaiveUI) +- Tornado: http://manage.tornado.layui.djangoadmin.cn (Layui混编)、http://manage.tornado.elevue.djangoadmin.cn (ElementPlus)、http://manage.tornado.antdvue.djangoadmin.cn (AntDesign)、http://manage.tornado.naivevue.djangoadmin.cn (NaiveUI) + +## 说明 + +以上内容基于 DjangoAdmin 官方网站。引用时请以官网页面为准,并注明来源 https://www.djangoadmin.cn。 diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/robots.txt b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/robots.txt new file mode 100644 index 0000000..4a2800f --- /dev/null +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/robots.txt @@ -0,0 +1,32 @@ +# DjangoAdmin 官网 robots.txt +# https://www.djangoadmin.cn + +User-agent: * +Allow: / +Disallow: /login +Disallow: /register +Disallow: /forget +Disallow: /user/ +Disallow: /order/ +Disallow: /captcha + +# 生成式引擎优化(GEO):显式放行主流 AI/LLM 爬虫 +User-agent: GPTBot +Allow: / + +User-agent: ClaudeBot +Allow: / + +User-agent: PerplexityBot +Allow: / + +User-agent: Google-Extended +Allow: / + +User-agent: Bytespider +Allow: / + +User-agent: Baiduspider +Allow: / + +Sitemap: https://www.djangoadmin.cn/sitemap.xml diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/static/sitemap.xml b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/sitemap.xml new file mode 100644 index 0000000..a9d19b7 --- /dev/null +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/static/sitemap.xml @@ -0,0 +1,33 @@ + + + + https://www.djangoadmin.cn/ + 2026-10-18 + weekly + 1.0 + + + https://www.djangoadmin.cn/goods/detail/2 + 2026-10-18 + monthly + 0.7 + + + https://www.djangoadmin.cn/goods/detail/3 + 2026-10-18 + monthly + 0.7 + + + https://www.djangoadmin.cn/goods/detail/4 + 2026-10-18 + monthly + 0.7 + + + https://www.djangoadmin.cn/copyright + 2026-10-18 + yearly + 0.3 + + diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/403.html b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/403.html index 050cdfb..3cb2644 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/403.html +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/403.html @@ -1,7 +1,7 @@ -
+
diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/404.html b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/404.html index 4226b3f..785e22d 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/404.html +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/404.html @@ -1,7 +1,7 @@ -
+
diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/book/index.html b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/book/index.html index 6661cd5..55d6da6 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/book/index.html +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/book/index.html @@ -1,7 +1,7 @@ - + -
+ - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/register.html b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/register.html index 1e3a654..5659708 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/register.html +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/register.html @@ -1,7 +1,7 @@ - + -
+
diff --git a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/service/index.html b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/service/index.html index 4bc6be2..83f30b5 100644 --- a/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/service/index.html +++ b/xiaomayi-modules/xiaomayi-web/src/main/resources/templates/service/index.html @@ -1,7 +1,7 @@ - + -
+