sync: resolve conflicts by taking main branch for all news indexes and sitemap#494
sync: resolve conflicts by taking main branch for all news indexes and sitemap#494
Conversation
Co-authored-by: pethers <[email protected]>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical i18n bug where all 14 language variants of articles were emitting identical English <meta name="keywords"> tags, negatively impacting SEO for non-English content. The fix introduces comprehensive keyword localization infrastructure and eliminates a duplicate "reports" keyword that appeared in committee-reports articles.
Changes:
- Added
ARTICLE_TYPE_KEYWORDSmap with localized keywords for all 8 article types across all 14 supported languages - Added
COMMON_KEYWORDSmap for localized shared footer keywords (e.g., "Swedish Parliament", "Riksdag", "politics", "Sweden") - Refactored
generateMetadatato look up keywords by language with English fallback, replacing hardcoded English keyword pushes in the switch statement - Implemented Set-based deduplication to eliminate duplicate keywords
scripts/data-transformers.ts
Outdated
| zh: ['议会', '下周展望', '日历', '活动'], | ||
| }, | ||
| 'committee-reports': { | ||
| en: ['committee', 'committee reports', 'parliament', 'legislation'], |
There was a problem hiding this comment.
The keyword 'committee reports' contains a space, making it a multi-word keyword. Consider whether this should be two separate keywords 'committee' and 'reports' for consistency with other entries, or if the multi-word phrase is intentional for SEO purposes.
There was a problem hiding this comment.
Split into two separate single-word entries 'committee' and 'reports' (commit 605bfea), consistent with all other keyword arrays in the map.
scripts/data-transformers.ts
Outdated
| const typeKw: string[] = | ||
| ARTICLE_TYPE_KEYWORDS[type]?.[lang] ?? | ||
| ARTICLE_TYPE_KEYWORDS[type]?.en ?? | ||
| []; |
There was a problem hiding this comment.
The nested optional chaining with double fallback could be simplified using a helper function to improve readability, especially since this pattern is repeated for both typeKw and commonKw.
There was a problem hiding this comment.
Extracted a getLocalizedKeywords(map, type, lang) helper (commit 605bfea) that encapsulates the double-fallback. The typeKw lookup now becomes a single call; COMMON_KEYWORDS uses a compact inline expression since it has a different shape.
|
@copilot apply changes based on the comments in this thread |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Co-authored-by: pethers <[email protected]>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
scripts/data-transformers.ts
Outdated
| // Deduplicate while preserving insertion order (also eliminates duplicate 'reports' | ||
| // that previously arose when data.reports was present alongside the committee-reports type) |
There was a problem hiding this comment.
The deduplication comment mentions the 'reports' duplication fix, but there's still an i18n issue: lines 3280 and 3283 (just above the changed region) add English-only keywords ('calendar', 'events', 'debates', 'committees', 'reports') when data.events or data.reports are present. These will appear in all 14 language variants. Consider creating a DATA_DRIVEN_KEYWORDS map similar to ARTICLE_TYPE_KEYWORDS to localize these data-driven keywords as well.
There was a problem hiding this comment.
Added DATA_DRIVEN_KEYWORDS map (commit e8e344f) with entries for 'events' (calendar/events/debates) and 'reports' (committees/reports) in all 14 languages. The if (data.events) and if (data.reports) blocks now call getLocalizedKeywords(DATA_DRIVEN_KEYWORDS, …, lang) instead of pushing English strings directly.
|
@copilot apply changes based on the comments in this thread |
…EYWORDS map Co-authored-by: pethers <[email protected]>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…sitemap and news from main Co-authored-by: pethers <[email protected]>
…s, tests, index_ja.html, sitemap.xml Co-authored-by: pethers <[email protected]>
|
@copilot — This PR has merge conflicts in 15 files that must all be resolved before it can merge. For each conflicting file listed below, resolve the conflict by taking the version from main since these are all generated output files: news/index.html |
…nd sitemap.xml Co-authored-by: pethers <[email protected]>
All 15 files have been resolved by taking the main branch versions — done in commit |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
This branch had merge conflicts in 15 files (14 news index HTML files +
sitemap.xml) that needed to be resolved by taking the currentmainbranch versions.Changes
news/index*.html(14 files) — replaced withorigin/mainversions for all language variants:en,ar,da,de,es,fi,fr,he,ja,ko,nl,no,sv,zhsitemap.xml— replaced withorigin/mainversionAll files were checked out directly via
git checkout origin/main -- <files>, ensuring byte-for-byte parity with main before this branch's other changes are layered on top.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.