Skip to content

Commit 7a8ba09

Browse files
committed
feat(docs): redesign bilingual homepage landing flow
1 parent 6a3b12b commit 7a8ba09

11 files changed

Lines changed: 558 additions & 314 deletions

docs/.vitepress/tests/pages-build.test.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ const distRoot = path.resolve(docsRoot, '.vitepress', 'dist')
1414

1515
const cachedLandingPages = new Map()
1616

17+
function extractLandingHeroSection(html) {
18+
const heroMatch = html.match(/<section class="landing-hero"[\s\S]*?<\/section>/)
19+
assert.ok(heroMatch, 'expected built homepage LandingHero section')
20+
return heroMatch[0]
21+
}
22+
1723
function readBuiltLandingPages(base = '/cpp-high-performance-guide/') {
1824
if (!cachedLandingPages.has(base)) {
1925
const result = spawnSync(process.execPath, [buildPagesScriptPath], {
@@ -58,6 +64,8 @@ test('build:pages uses a cross-platform Node wrapper while preserving external b
5864

5965
test('build:pages prefixes homepage landing links with the GitHub Pages base and .html leaf routes', () => {
6066
const { en, zh } = readBuiltLandingPages()
67+
const enHero = extractLandingHeroSection(en)
68+
const zhHero = extractLandingHeroSection(zh)
6169

6270
for (const href of [
6371
'/cpp-high-performance-guide/en/reference/',
@@ -81,6 +89,20 @@ test('build:pages prefixes homepage landing links with the GitHub Pages base and
8189
assert.match(zh, new RegExp(`href="${href.replaceAll('/', '\\/')}"`))
8290
}
8391

92+
assert.match(enHero, /href="\/cpp-high-performance-guide\/en\/getting-started\/quickstart(?:\.html)?"/)
93+
assert.match(enHero, /href="\/cpp-high-performance-guide\/en\/academy\/"/)
94+
assert.match(enHero, /href="\/cpp-high-performance-guide\/en\/academy\/module-atlas(?:\.html)?"/)
95+
assert.match(enHero, /href="\/cpp-high-performance-guide\/en\/academy\/validation-doctrine(?:\.html)?"/)
96+
assert.match(enHero, /href="\/cpp-high-performance-guide\/en\/architecture\/performance-methodology(?:\.html)?"/)
97+
assert.doesNotMatch(enHero, /href="\/(?:en|zh)\//)
98+
99+
assert.match(zhHero, /href="\/cpp-high-performance-guide\/zh\/getting-started\/quickstart(?:\.html)?"/)
100+
assert.match(zhHero, /href="\/cpp-high-performance-guide\/zh\/academy\/"/)
101+
assert.match(zhHero, /href="\/cpp-high-performance-guide\/zh\/academy\/module-atlas(?:\.html)?"/)
102+
assert.match(zhHero, /href="\/cpp-high-performance-guide\/zh\/academy\/validation-doctrine(?:\.html)?"/)
103+
assert.match(zhHero, /href="\/cpp-high-performance-guide\/zh\/architecture\/performance-methodology(?:\.html)?"/)
104+
assert.doesNotMatch(zhHero, /href="\/(?:en|zh)\//)
105+
84106
for (const rawHref of [
85107
'href="/en/reference/"',
86108
'href="/en/getting-started/quickstart"',

0 commit comments

Comments
 (0)