Skip to content

Commit 7e07923

Browse files
committed
feat: rewrite yew.rs website with Yew (#4069)
Replace the Docusaurus-based website with a pure Rust/Yew implementation. The SSG pipeline compiles each page to WASM, runs wasm-bindgen and wasm-opt, then captures SSR output for SEO-friendly HTML. All docs (5 versions x 4 languages), blog posts, community pages, search, and 404 are generated as static files. Key features: - Content model with dual HTML/Markdown rendering for copy-as-markdown - Syntax highlighting via syntect with light/dark themes - Collapsible sidebar, table of contents, breadcrumbs, pagination - 3-state theme toggle (light/dark/system) - Blog with date-prefixed URLs, index, sidebar, RSS and Atom feeds - Full-page Algolia search with version faceting - SEO: hreflang, OG tags, JSON-LD breadcrumbs, canonical URLs - E2E tests with fantoccini/geckodriver - Deduplicated versioned docs across 0.20/0.21/0.22/0.23/next
1 parent c6c62d7 commit 7e07923

File tree

2,839 files changed

+140023
-428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,839 files changed

+140023
-428
lines changed

.github/workflows/build-website.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ on:
33
pull_request:
44
branches: [master]
55
paths:
6-
- "website/**"
7-
- "firebase.json"
6+
- "yew-rs/**"
7+
- "website/static/**"
8+
- "Cargo.toml"
9+
- "Cargo.lock"
810
- ".github/workflows/*-website.yml"
911
push:
1012
branches: [master]
1113
paths:
12-
- "website/**"
13-
- "firebase.json"
14+
- "yew-rs/**"
15+
- "website/static/**"
16+
- "Cargo.toml"
17+
- "Cargo.lock"
1418
- ".github/workflows/*-website.yml"
1519

1620
jobs:
@@ -20,40 +24,36 @@ jobs:
2024
steps:
2125
- uses: actions/checkout@v6
2226

23-
- name: Setup node
24-
uses: actions/setup-node@v6
27+
- name: Setup toolchain
28+
uses: dtolnay/rust-toolchain@master
2529
with:
26-
node-version: "lts/Jod"
27-
package-manager-cache: false
30+
toolchain: stable
31+
targets: wasm32-unknown-unknown
2832

29-
- name: Install dependencies
30-
run: |
31-
cd website
32-
npm ci
33+
- uses: Swatinem/rust-cache@v2
34+
with:
35+
save-if: ${{ github.ref == 'refs/heads/master' }}
3336

34-
- name: Run prettier
35-
id: fmt
36-
continue-on-error: true
37-
run: |
38-
cd website
39-
npm run fmt
37+
- name: Install wasm-bindgen-cli
38+
shell: bash
39+
run: ./ci/install-wasm-bindgen-cli.sh
4040

41-
- if: steps.fmt.outcome == 'failure'
42-
run: |
43-
cd website
44-
npm run fmt:write
45-
git diff
46-
exit 1
41+
- name: Get latest wasm-opt version
42+
id: wasm-opt
43+
uses: pozetroninc/github-action-get-latest-release@master
44+
with:
45+
repository: WebAssembly/binaryen
46+
excludes: prerelease, draft
47+
token: ${{ secrets.GITHUB_TOKEN }}
4748

48-
- name: Check Translations
49+
- name: Install wasm-opt
4950
run: |
50-
cd website
51-
npm run check-translations
51+
VERSION="${{ steps.wasm-opt.outputs.release }}"
52+
curl -sL "https://github.com/WebAssembly/binaryen/releases/download/${VERSION}/binaryen-${VERSION}-x86_64-linux.tar.gz" | tar xz
53+
sudo install "binaryen-${VERSION}/bin/wasm-opt" /usr/local/bin/
5254
53-
- name: Build
54-
run: |
55-
cd website
56-
npm run build
55+
- name: Build site
56+
run: cargo run --release -p yew-site-ssg
5757

5858
- name: Upload build artifact
5959
uses: actions/upload-artifact@v7

.github/workflows/test-website.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,54 @@ jobs:
4444

4545
- name: Run website code snippet tests
4646
run: cargo test -p website-test --target wasm32-unknown-unknown
47+
48+
website_e2e:
49+
name: Website E2E Navigation
50+
needs: [website_tests]
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v6
54+
55+
- name: Setup toolchain
56+
uses: dtolnay/rust-toolchain@master
57+
with:
58+
toolchain: stable
59+
targets: wasm32-unknown-unknown
60+
61+
- uses: Swatinem/rust-cache@v2
62+
with:
63+
save-if: false
64+
65+
- name: Install wasm-bindgen-cli
66+
shell: bash
67+
run: ./ci/install-wasm-bindgen-cli.sh
68+
69+
- name: Get latest wasm-opt version
70+
id: wasm-opt
71+
uses: pozetroninc/github-action-get-latest-release@master
72+
with:
73+
repository: WebAssembly/binaryen
74+
excludes: prerelease, draft
75+
token: ${{ secrets.GITHUB_TOKEN }}
76+
77+
- name: Install wasm-opt
78+
run: |
79+
VERSION="${{ steps.wasm-opt.outputs.release }}"
80+
curl -sL "https://github.com/WebAssembly/binaryen/releases/download/${VERSION}/binaryen-${VERSION}-x86_64-linux.tar.gz" | tar xz
81+
sudo install "binaryen-${VERSION}/bin/wasm-opt" /usr/local/bin/
82+
83+
- name: Build site
84+
run: cargo run --release -p yew-site-ssg
85+
86+
- uses: browser-actions/setup-geckodriver@latest
87+
with:
88+
token: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Start geckodriver
91+
run: geckodriver --port 4444 &
92+
93+
- name: Run e2e tests
94+
env:
95+
HEADLESS: "1"
96+
WEBDRIVER_URL: "http://localhost:4444"
97+
run: cargo test -p website-e2e -- --test-threads=1

0 commit comments

Comments
 (0)