Conversation
Size ComparisonDetails
✅ None of the examples has changed their size significantly. |
832800f to
0ec8ecd
Compare
|
Visit the preview URL for this PR (updated for commit 8d46462): https://yew-rs--pr4069-yew-docs-185gwe7t.web.app (expires Mon, 06 Apr 2026 21:19:29 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
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
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
ce3a6d7 to
15b5594
Compare
|
@WorldSEnder |
|
Size Note: |
This is now implemented. Each locale (en, ja, zh-Hans, zh-Hant) has one SPA binary powered by Architecture:
Per-page WASM download went from ~1.7 MB (per navigation) to ~2.8 MB (once per session, then all version/page switches are instant. 930 kB after compression, seems acceptible). Full build time in CI reduces tenfold (90 minutes -> 11 minutes). |
|
As previously commented, a huge bloat is syntect. We don't have codeblocks on a lot of pages like the home page and the getting-started/examples page. But the SPA approach now inevitably bundles it. after #3932 lands though, we can delay loading the CodeBlock component. This will even beat docusaurus. Note docusaurs based getting-started/examples and getting-started/editor-setup currently load JavaScript of identical size. |
… and stylist CSS injection Port the 3-in-1 #[comp] attribute macro from nnom/proc to yew-rs/proc and migrate all yew-site-lib components to use it, replacing manual Props structs and #[styled_component].
Also fixed version banner dark mode by using component-scoped [data-theme="dark"] *& selectors instead of hardcoded light-mode colors.
Descriptions were lost during the Docusaurus-to-Yew rewrite: the SSG had no mechanism for custom descriptions, and its HTML-parsing fallback operated on the full body (including navbar/sidebar), producing garbage. Add Content::description_text() which computes descriptions directly from the structured block model: explicit description if set via with_description(), else first paragraph plaintext, else first h2. Thread descriptions through a new RenderedPage struct in the rendering pipeline, eliminating all HTML parsing from the SSG. Restore ~336 page descriptions across all locales and doc versions from the old MDX front matter values, and add e2e tests.
# Conflicts: # website/docs/tutorial/index.mdx # website/i18n/ja/docusaurus-plugin-content-docs/current/tutorial/index.mdx # website/i18n/ja/docusaurus-plugin-content-docs/version-0.22/tutorial/index.mdx # website/i18n/ja/docusaurus-plugin-content-docs/version-0.23/tutorial/index.mdx # website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/index.mdx # website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.22/tutorial/index.mdx # website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.23/tutorial/index.mdx # website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/tutorial/index.mdx # website/i18n/zh-Hant/docusaurus-plugin-content-docs/version-0.22/tutorial/index.mdx # website/i18n/zh-Hant/docusaurus-plugin-content-docs/version-0.23/tutorial/index.mdx # website/versioned_docs/version-0.20/tutorial/index.mdx # website/versioned_docs/version-0.21/tutorial/index.mdx # website/versioned_docs/version-0.22/tutorial/index.mdx # website/versioned_docs/version-0.23/tutorial/index.mdx
| without all of you. Thanks!", | ||
| ], | ||
| ]) | ||
| ); |
There was a problem hiding this comment.
I didn't realize that the plan was to fully replace the mdx documents with their rust source code and I don't agree with this design decision. The components look good, and the macros are also helpful. But I would not want to write a blog post in this format, I would want to write the markdown where this came from.
Compare the above to the markdown:
- Have to learn magic macros (
crate::blog_page!,h!etc) which are btw notuseimported into the file due to more macro magic inblog_page! - there is
BLOG_POSTSslugs in a separate part, with a magic number index - my editor understands markdown more or less, it does not understand this. Even with a rust language server running on the side, which takes minutes to start and load the macro and dependencies.
What's the advantage here when using rust code? All files seem to follow a strict form or were there parts that needed manual editing after the conversion?
There was a problem hiding this comment.
But I would not want to write a blog post in this format, I would want to write the markdown where this came from.
I can get behind this sentiment. Valid concerns.
I'll do some research on mdx parsers and see if we can achieve the same thing with minimal edits to the mdx files.
fixes #2779
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 have standalone index.html with customized
<head/>content.4 major bundles are produced, one for each locale. Once a bundle is loaded, all navigation are done through yew-router and doesn't require re-fetching unless the user navigates to a different locale. See this comment below for more details.
This is a quite faithful rewrite of our old docusaurus based website.
Key features:
getting-started/examplespage to show a gallery of examples, parsed from disk at compile time. (new feature)Some design choices and notes:
thirtyfour,chromiumoxidewere considered and Fantoccini has the most downloads, most stars, most recent release cadence.MDX:
External Links:
Get Startedbutton and theLearn Morebuttons on each feature card now consume the version and locale too. (new feature){category}/introduction.mdxfiles. Most pages (7 out of 9) had aslugfront matter in the old mdx files so that the slug{category}by itself shows the introduction page, (and{category}/introductiongives a 404). The only two exceptions were:https://yew.rs/docs/next/getting-started/introductionandhttps://yew.rs/docs/advanced-topics/struct-components/introduction. The new code unifies the aliasing behaviour. It means old urls todocs/next/getting-started/introductionanddocs/advanced-topics/struct-components/introductionwill hit 404.Future Considerations
This is not easy because the subject-verb-object order in different languages are different.