Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update document.title to improve SEO #210

Merged
merged 1 commit into from
Nov 22, 2024
Merged

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Nov 22, 2024

Summary by CodeRabbit

  • 新特性
    • 更新了“未找到页面”组件中的按钮文本,以反映新的品牌名称“Ant Design X”。
    • 修改了主题编辑器中的标题和元标签,更新为“Ant Design X”。
    • 在通用标题组件中,标题字符串已更新为包含“Ant Design X”。
    • 在索引布局组件中,标题现在包括描述信息,格式为“{标题} - {描述}”。

Copy link
Contributor

coderabbitai bot commented Nov 22, 2024

📝 Walkthrough

Walkthrough

此次更改涉及多个组件的标题和按钮文本的修改,以反映“Ant Design X”的品牌更新。在NotFoundPage组件中,按钮的文本在中文环境下从“返回 Ant Design 首页”更改为“返回 Ant Design X 首页”。在CustomTheme组件中,Helmet组件的标题和og:title元属性也进行了相应更新。此外,CommonHelmet组件和IndexLayout组件的标题处理逻辑也进行了调整,以包含新的品牌名称。这些更改均未影响组件的其他功能或逻辑。

Changes

文件路径 更改摘要
.dumi/pages/404/index.tsx 修改按钮文本为“返回 Ant Design X 首页”
.dumi/pages/theme-editor/index.tsx 更新Helmet组件标题和og:title为“Ant Design X”
.dumi/theme/common/CommonHelmet.tsx 更新标题字符串为“Ant Design X”
.dumi/theme/layouts/IndexLayout/index.tsx 更新<title>元素格式为{title} - {desc}

Possibly related PRs

Suggested reviewers

  • MadCcc

🐰 在这片代码的草地上,
“Ant Design X”如花绽放。
按钮新名声势浩荡,
组件更新,功能依然强。
让我们一起欢庆这变化,
兔子跳跃,乐在其中! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Nov 22, 2024

Preview is ready

Copy link

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 83ac567
Status: ✅  Deploy successful!
Preview URL: https://129f2004.ant-design-x.pages.dev
Branch Preview URL: https://docs-better-seo.ant-design-x.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
.dumi/theme/layouts/IndexLayout/index.tsx (2)

17-19: 建议添加标题长度验证和空值处理

标题格式更改有利于SEO,但建议增加以下优化:

  1. 处理 desc 为空的情况
  2. 确保标题长度符合搜索引擎建议(通常建议不超过60个字符)

建议按照以下方式优化代码:

 <title>
-  {title} - {desc}
+  {title}${desc ? ` - ${desc}` : ''}
 </title>

20-21: 建议完善 Open Graph 标签

为了提升社交媒体分享效果,建议更新 og:title 的内容格式与页面标题保持一致。

建议修改如下:

- <meta property="og:title" content={title} />
+ <meta property="og:title" content={`${title}${desc ? ` - ${desc}` : ''}`} />
.dumi/pages/theme-editor/index.tsx (1)

70-71: 标题更新符合 SEO 最佳实践!

标题结构合理,使用本地化文本配合品牌名称。为进一步优化 SEO,建议添加更多相关的 meta 标签。

建议添加以下 meta 标签来增强 SEO 效果:

 <Helmet>
   <title>{`${locale.title} - Ant Design X`}</title>
   <meta property="og:title" content={`${locale.title} - Ant Design X`} />
+  <meta name="description" content={`${locale.title} - 在线可视化主题编辑器`} />
+  <meta property="og:description" content={`${locale.title} - 在线可视化主题编辑器`} />
+  <meta name="keywords" content="Ant Design X, 主题编辑器, 在线编辑, 主题定制" />
 </Helmet>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 134da19 and 83ac567.

📒 Files selected for processing (4)
  • .dumi/pages/404/index.tsx (1 hunks)
  • .dumi/pages/theme-editor/index.tsx (1 hunks)
  • .dumi/theme/common/CommonHelmet.tsx (1 hunks)
  • .dumi/theme/layouts/IndexLayout/index.tsx (1 hunks)
🔇 Additional comments (2)
.dumi/theme/common/CommonHelmet.tsx (1)

10-10: 品牌名称更新已正确实施

品牌名称从 "Ant Design" 更新为 "Ant Design X" 的修改已正确完成,并且在 404 页面和常规页面的标题中保持一致。这些更改符合 SEO 最佳实践,确保了文档标题和 og:title 元标签的同步更新。

运行以下脚本以验证整个代码库中的品牌名称更新是否一致:

Also applies to: 14-14

✅ Verification successful

品牌名称更新已正确且一致地实施

根据代码库扫描结果,"Ant Design X" 品牌名称在整个代码库中已得到一致的使用,包括:

  • 组件标题和描述
  • 文档和示例
  • 错误页面标题
  • README 和 CHANGELOG 文件

404页面标题的更新符合整体品牌标识规范。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查代码库中是否还存在旧的品牌名称引用

# 搜索可能遗漏更新的文件
rg -l "Ant Design(?![^X])" --type=tsx --type=ts --type=jsx --type=js

# 检查 HTML 标题和元标签中的品牌名称
ast-grep --pattern 'title>$_Ant Design(?![^X])$_</title'
ast-grep --pattern 'meta property="og:title" content="$_Ant Design(?![^X])$_"'

Length of output: 442


Script:

#!/bin/bash
# 搜索包含 "Ant Design" 的文件
rg -l --pcre2 "Ant Design" --type=tsx --type=ts --type=jsx --type=js

# 显示包含 "Ant Design" 的具体内容和上下文
rg --pcre2 -C 2 "Ant Design" --type=tsx --type=ts --type=jsx --type=js

# 检查标题相关的代码
ast-grep --pattern 'title = $_'
ast-grep --pattern 'title: $_'

Length of output: 266


Script:

#!/bin/bash
# 搜索包含 "Ant Design" 的文件,不指定文件类型
rg -l "Ant Design"

# 显示包含 "Ant Design" 的具体内容和上下文
rg -C 2 "Ant Design"

# 查找所有包含 title 的 TypeScript/JavaScript 文件
find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) -exec grep -l "title" {} \;

Length of output: 68993

.dumi/pages/404/index.tsx (1)

51-51: 品牌名称更新正确!

品牌名称从 "Ant Design" 更新为 "Ant Design X" 的修改符合预期。

运行以下脚本以验证整个代码库中品牌名称的一致性:

✅ Verification successful

品牌名称更新已完成且一致!

根据代码库搜索结果,所有相关文件中的品牌名称都已正确更新为 "Ant Design X"。404 页面中的品牌名称更新符合整体代码库的品牌标识规范。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查代码库中的品牌名称是否统一更新

# 搜索可能包含旧品牌名称的文件
rg -l "Ant Design(?!\s+X)" --type=tsx --type=ts --type=jsx --type=js

# 检查页面标题相关的组件
ast-grep --pattern 'title={$_}'

Length of output: 336


Script:

#!/bin/bash
# 使用 PCRE2 正则表达式搜索品牌名称
rg --pcre2 -l "Ant Design(?!\s+X)" --type=tsx --type=ts --type=jsx --type=js

# 搜索包含 "Ant Design" 的具体内容,以便进行人工分析
rg "Ant Design" --type=tsx --type=ts --type=jsx --type=js -C 2

# 搜索标题相关的内容
rg "title.*Ant Design" --type=tsx --type=ts --type=jsx --type=js

Length of output: 294


Script:

#!/bin/bash
# 不指定文件类型,直接搜索所有文件中的品牌名称
rg --pcre2 "Ant Design(?!\s+X)" -C 2

# 搜索所有文件中的品牌名称相关内容
rg "Ant Design" -C 2

# 使用 fd 查找所有可能的前端文件,然后用 xargs 和 grep 搜索
fd -e tsx -e ts -e jsx -e js | xargs grep -l "Ant Design"

Length of output: 90797

Copy link
Collaborator

@YumoImer YumoImer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@YumoImer YumoImer merged commit 8dcda09 into main Nov 22, 2024
9 checks passed
@YumoImer YumoImer deleted the docs/better-seo branch November 22, 2024 07:28
@coderabbitai coderabbitai bot mentioned this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants