processAll.sh 5.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # 加备案号
  2. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#<div id="footer-text">#<div id="footer-text"><a rel="external nofollow" href="https://beian.miit.gov.cn/" target="_blank">鲁ICP备20024731号-1</a></br>#g'
  3. # 汉化
  4. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#Back to index#⏪回到目录#g'
  5. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#Last updated#更新时间:#g'
  6. sed -i 's#title="Caution"#title="愿景"#g' target/generated-docs/shoulder.html
  7. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#title="Tip"#title="提示"#g'
  8. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#title="Note"#title="注意"#g'
  9. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#title="Warning"#title="警告"#g'
  10. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#title="Caution"#title="注意!"#g'
  11. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#title="Important"#title="重要!"#g'
  12. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#css/site.css#/css/site.css#g'
  13. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#js/setup.js#/js/setup.js#g'
  14. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#js/site.js#/js/site.js#g'
  15. # 图片语法
  16. find target/generated-docs/ -type f -name "*.html" | xargs sed -r -i 's#images::(.+?)\[(.*?)\]#<img src="\1" alt="\2" \/>#g'
  17. # 语法检查
  18. # grep '`' target/generated-docs/*.html
  19. # grep -F '----' target/generated-docs/*.html
  20. # grep -F '[.line-through]' target/generated-docs/*.html
  21. # grep -F 'include::' target/generated-docs/*.html
  22. # grep -F '* ' target/generated-docs/*.html
  23. # grep -F 'Unresolved directive in ' target/generated-docs/*.html
  24. # 加图标
  25. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#<link rel="stylesheet" href="css/site.css">#<link rel="stylesheet" href="css/site.css"><link rel="shortcut icon" href="favicon.ico" type="image/svg+xml"><link rel="sitemap" href="/sitemap-index.xml">#g'
  26. cp -f doc/img/shoulder_svg_logo.svg target/generated-docs/favicon.svg
  27. cp -f doc/img/favicon.ico target/generated-docs/favicon.ico
  28. cp -f script/afterGenHtml/shoulder_logo_180.png target/generated-docs/apple-touch-icon.png
  29. cp -f script/afterGenHtml/manifest.json target/generated-docs/manifest.json
  30. cp -f script/afterGenHtml/search.html target/generated-docs/search.html
  31. # 替换logo
  32. cp -f doc/img/shoulder_with_world_logo.svg target/generated-docs/img/banner-logo.svg
  33. # 404 页面自动回首页
  34. sed -i 's#</title>#</title><meta http-equiv="refresh" content="10;url=https://doc.itlym.cn/shoulder.html">#g' target/generated-docs/404.html
  35. # ======================== SEO ========================
  36. cp -f script/afterGenHtml/robots.txt target/generated-docs/robots.txt
  37. cp -f script/afterGenHtml/sitemap.xml target/generated-docs/sitemap.xml
  38. # 网页语言
  39. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#<html lang="en">#<html lang="zh-CN">#g'
  40. # shoulder 通用 SEO:语言、字符集、安全策略、统一网站品牌(Shoulder文档)、统一网站类型为文章、支持手机端访问、禁止浏览器自带夜间模式、设置浏览器页面颜色为Spring主题色
  41. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#<meta name="author" content="lym">#<meta name="author" content="lym"><meta content="on" http-equiv="x-dns-prefetch-control"><meta charset="utf-8"><meta name="og:locale" content="zh-CN"><meta content="always" name="referrer"><meta content="Shoulder 文档" property="og:site_name"><meta content="article" property="og:type"><meta name="theme-color" content="#6db33f"><meta content="pc,mobile" name="applicable-device"><meta name="HandheldFriendly" content="true"/><meta name="MobileOptimized" content="width"/><meta name="nightmode" content="disable"><link rel="search" type="text/html" href="/search.html" title="shoulder 搜索">#g'
  42. # 千页千面----------
  43. # 统一透出图片为品牌logo
  44. find target/generated-docs/ -type f -name "*.html" | xargs sed -i 's#<meta name="author" content="lym">#<meta name="author" content="lym"><link rel="mask-icon" href="https://doc.itlym.cn/favicon.ico"><meta content="https://doc.itlym.cn/img/banner-logo.svg" itemprop="image" property="og:image"><meta property="og:image:type" content="image/svg"><meta property="og:image:width" content="2230"><meta property="og:image:height" content="539">#g'
  45. # 页面标题
  46. find target/generated-docs/ -type f -name "*.html" | xargs sed -r -i 's#<title>(.*?)</title>#<title>\1</title><meta content="\1" itemprop="name" property="og:title">#g'
  47. # 页面链接
  48. # <meta content="https://shoulder.itlym.cn/shoulder.html" property="og:url">
  49. # 说明
  50. find target/generated-docs/ -type f -name "*.html" | xargs sed -r -i 's#<meta name="description" content="(.*?)">#<meta content="\1" itemprop="name" property="og:description"><meta content="\1" itemprop="description" name="description">#g'
  51. # 主页地址
  52. #find target/generated-docs/ -type f -name "*.html" | xargs sed -r -i 's#<meta name="canonical" content="(.*?)">#<link rel="canonical" href="\1">#g'
  53. # og:tag
  54. find target/generated-docs/ -type f -name "*.html" | xargs sed -r -i 's#<meta name="ogtag" content="(.*?)">#<meta property="article:tag" content="\1"/>#g'
  55. # 重要页面强制搜索引擎保存
  56. sed -i 's#<meta name="author" content="lym">#<meta name="author" content="lym"><meta name="robots" content="index, follow">#g' target/generated-docs/index.html
  57. sed -i 's#<meta name="author" content="lym">#<meta name="author" content="lym"><meta name="robots" content="index, follow">#g' target/generated-docs/shoulder.html
  58. # 百度搜索引擎验证
  59. sed -i 's#</title>#</title><meta name="baidu-site-verification" content="codeva-TL1lDFcXWe"/>#g' target/generated-docs/index.html
  60. cp -f script/afterGenHtml/baidu_verify_codeva-ifxAQZKzNf.html target/generated-docs/