Skip to content

Fix zh-Hans front matter delimiter so four Chinese pages stop rendering as raw source - #476

Open
eastagiletracker wants to merge 1 commit into
diffbot:mainfrom
eastagiletracker:agile-board/fix-zh-hans-front-matter-fence
Open

Fix zh-Hans front matter delimiter so four Chinese pages stop rendering as raw source#476
eastagiletracker wants to merge 1 commit into
diffbot:mainfrom
eastagiletracker:agile-board/fix-zh-hans-front-matter-fence

Conversation

@eastagiletracker

Copy link
Copy Markdown

This PR proposes fixing the four zh-Hans documentation pages whose front matter opens with a triple-backtick markdown fence instead of ---, so Docusaurus parses them as pages again instead of wrapping each whole document in a code block. We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/379. You can sign in with your GitHub ID to claim ownership of the project.

What is broken

Four files under i18n/zh-Hans/docusaurus-plugin-content-docs/current/ begin with a triple-backtick markdown fence on line 1, where the YAML front-matter delimiter --- belongs, and close with the matching fence at end of file. Docusaurus therefore never parses any front matter: sidebar_position is dropped, the page title falls back to the source filename, the description meta tag is lost, and the whole document is rendered inside a single language-markdown code block.

Two of the four are routed by the build today, and both are live on docs.codegpt.co right now:

$ curl -s https://docs.codegpt.co/zh-Hans/docs/tutorial-features/unit_testing | grep -o '<title>[^<]*'
<title>unit_testing | CodeGPT

$ curl -s https://docs.codegpt.co/zh-Hans/docs/cookbook/generate_unit_test | grep -o '<title>[^<]*'
<title>generate_unit_test | CodeGPT

Both pages render <h1>unit_testing</h1> and <h1>generate_unit_test</h1> — the source filename, in English — followed by the entire translation as a syntax-highlighted code block, and the first one serves no description meta tag at all. The other two files, tutorial-features/vision.md and tutorial-features/stackoverflow.md, carry the identical defect but have no English source page, so the build does not route them yet; they are fixed here as well so the same breakage does not reappear when those pages come back.

The change

Line 1 of each file becomes ---, and the trailing fence that wrapped the document is removed. Nothing else is touched — 4 lines changed, 4 lines removed, no translated text edited, no other locale affected.

How it was verified

Reproduced on a clean clone of main at a08f6dc, before any edit:

$ npm ci && npm run build
$ grep -o '<title>[^<]*' build/zh-Hans/docs/tutorial-features/unit_testing/index.html
<title>unit_testing | CodeGPT
$ grep -o '<title>[^<]*' build/zh-Hans/docs/cookbook/generate_unit_test/index.html
<title>generate_unit_test | CodeGPT

Then on the same tree with this change applied:

$ npm run build
$ grep -o '<title>[^<]*' build/zh-Hans/docs/tutorial-features/unit_testing/index.html
<title>单元测试 | CodeGPT
$ grep -o '<title>[^<]*' build/zh-Hans/docs/cookbook/generate_unit_test/index.html
<title>编写单元测试 | CodeGPT

npm run build exits 0 both before and after, emits the same 256 pages, and prints a byte-identical set of broken-link warnings, so the pre-existing ones are untouched and nothing new goes red. Alongside the titles, both pages emit their description meta tag again, their bodies render as documentation rather than as a code block, and the Chinese sidebar entry changes from unit_testing to 单元测试 with sidebar_position: 8 honoured, which restores the same ordering the English page uses.

How this was managed

We imported this repository's issues and pull requests into a live board and used it to run this fix: the work is tracked as its own story on the board, alongside the 453 stories imported from your issues and pull requests.

board

If you'd rather not receive contributions like this, reply no-more-prs on this pull request and we won't open any further ones on your repositories.


Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com

…as source

Four Chinese pages open with a ```markdown fence where the front matter
delimiter should be, and close with a matching fence at EOF, so Docusaurus
wraps the whole document in a code block instead of parsing it. On the two
pages the build routes today the title falls back to the source filename,
sidebar_position is dropped and the meta description is lost.
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.

1 participant