Commit 667baac
authored
feat(seo): add h1 + BreadcrumbList and enrich BlogPosting schema on blog posts / 博客文章增加 h1 与 BreadcrumbList 并丰富 BlogPosting 结构化数据 (#599)
* feat(seo): add h1 + BreadcrumbList and enrich BlogPosting schema on blog posts
Render the post title as a real <h1> (was <h2>) so each post carries a single
top-level heading with its primary keyword; MDX body content keeps mapping
markdown headings to <h2>, guaranteeing exactly one <h1> per page.
Extract the BlogPosting JSON-LD into a pure, unit-testable builder and enrich it
with the recommended Article fields: image (post OG image URL), inLanguage,
mainEntityOfPage, and publisher.logo (ImageObject). Add a separate
BreadcrumbList JSON-LD (Home -> Blog -> post) to posts, mirroring the compare
pages. All applied to both the English and /zh post pages, with translated
breadcrumb labels and zh-CN language/URLs on the Chinese side.
中文:将博客文章标题渲染为真正的 <h1>(原为 <h2>),使每篇文章拥有唯一的顶级标题并承载主关键词;
MDX 正文标题仍映射为 <h2>,从而保证每页只有一个 <h1>。将 BlogPosting 结构化数据抽取为纯函数、
可单元测试的构建器,并补齐推荐的 Article 字段:image(文章 OG 图片 URL)、inLanguage、
mainEntityOfPage 与 publisher.logo(ImageObject)。同时为文章新增独立的 BreadcrumbList
结构化数据(首页 -> 博客 -> 文章),与 compare 页面保持一致。以上改动同时应用于英文与 /zh 文章页,
中文侧使用翻译后的面包屑标签及 zh-CN 语言标记与 URL。
* fix(seo): drop conflicting publisher.logo dimensions in blog JSON-LD
Cursor Bugbot flagged the BlogPosting publisher.logo height (675) as
inconsistent with the codebase. The OG_IMAGE asset is genuinely 1200×675
(verified via sips), but the root layout declares it 1200×630 and its
Organization logo omits dimensions entirely. Rather than assert a number
that conflicts with the root layout, omit the optional width/height and
match the existing Organization-logo precedent in layout.tsx.
中文:修复博客 JSON-LD 中 publisher.logo 尺寸不一致的问题。Cursor Bugbot 指出
logo 声明的高度(675)与代码库其他处不一致:OG_IMAGE 实际为 1200×675(经 sips
验证),但根布局声明为 1200×630,且其 Organization logo 未声明尺寸。为避免与根布局
冲突,这里省略可选的 width/height,与 layout.tsx 中 Organization logo 的既有做法保持一致。1 parent 93ae9b4 commit 667baac
5 files changed
Lines changed: 289 additions & 38 deletions
File tree
- packages/app
- cypress/e2e
- src
- app
- blog/[slug]
- zh/blog/[slug]
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 141 | + | |
| 142 | + | |
155 | 143 | | |
156 | 144 | | |
157 | 145 | | |
158 | 146 | | |
159 | 147 | | |
160 | 148 | | |
| 149 | + | |
161 | 150 | | |
162 | 151 | | |
163 | 152 | | |
164 | 153 | | |
165 | 154 | | |
166 | | - | |
| 155 | + | |
167 | 156 | | |
168 | 157 | | |
169 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 137 | + | |
| 138 | + | |
152 | 139 | | |
153 | 140 | | |
154 | 141 | | |
155 | 142 | | |
156 | 143 | | |
157 | 144 | | |
| 145 | + | |
158 | 146 | | |
159 | 147 | | |
160 | 148 | | |
161 | 149 | | |
162 | 150 | | |
163 | | - | |
| 151 | + | |
164 | 152 | | |
165 | 153 | | |
166 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
| 7 | + | |
5 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
6 | 13 | | |
7 | 14 | | |
8 | 15 | | |
| |||
592 | 599 | | |
593 | 600 | | |
594 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
0 commit comments