Repository navigation
Per-page social preview cards for docs and blog - #672
Open
jkelleyrtp wants to merge 1 commit into
Open
jkelleyrtp wants to merge 1 commit into
jkelleyrtp wants to merge 1 commit into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Links to docs pages and blog posts currently unfurl as the generic homepage card (same
<title>, description andopengraph.pngon every route). This PR makes every page carry its own metadata and gives docs/blog pages a generated 1200×630 preview image.Per-route meta (
packages/docsite/src/seo.rs) —Headis now driven byPageMeta::for_route(&route):<title>,meta[description],link[canonical], fullog:*set (og:url,og:image+ width/height/alt,og:site_name,og:typewebsite|article),twitter:*(summary_large_image,@dioxuslabs), and for blog postsarticle:published_time/article:author."{page} – Dioxus 0.7 Docs"; generic pages ("Overview") get their chapter or SUMMARY part prefixed ("Core Concepts: Overview – …"). Description = first paragraph of the page's markdown (markdown_description, via pulldown-cmark: skips headings/html/code/{{#include}}, ~200 chars)."Title $ Category $ Date $ Description"SUMMARY format (page_to_metais now shared and no longer panics on malformed lines). Also fixedintroducing-dioxus.md's swapped category/date inSUMMARY.md, which was showing "Release Notes" as the date on the blog list.noindexand fall back to the default image; the default image now goes throughasset!()so it resolves to the real hashed path (the old hardcoded/assets/static/opengraph.pngURL was likely stale).Generated OG images (
packages/docsite/src/og_image.rs, server feature only)server --generate-search-indexstep ingh-pages.yml, so no workflow changes: writespublic/og/<slug>.pngfor all 0.7 docs pages, blog posts,/blog,/awesome,/deploy(109 images, ~0.1 s each in release).resvg(bundled Inter fonts underpackages/docsite/og/fonts, OFL) — dark card with the DNA logo, breadcrumb eyebrow (DOCS · 0.7 · CORE CONCEPTS · BUILDING USER INTERFACES), title (auto-shrinks 76→52px, ≤3 lines), description (≤2 lines, ellipsised). Text is measured withab_glyphfor wrapping; inner breadcrumbs are dropped when the eyebrow doesn't fit.seo::og_image_slug(route)(/learn/0.7/essentials/ui/rsx→learn-0.7-essentials-ui-rsx) is the single source for both theog:imageURL and the file name.Verified locally with the same commands as CI (
dx build --web --fullstack true --features fullstack,production --release --ssgthenserver --generate-search-index): SSG HTML for/,/learn/0.7/essentials/ui/rsx,/blog/release-070contains each tag exactly once with the expected values, andpublic/og/contains 109 PNGs.To preview cards locally without a full build:
OG_PREVIEW_DIR=/tmp/og cargo test -p dioxus_docs_site --features server og_image.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/c3136db61b114f4bba89e1d74f9ed07c
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/c3136db61b114f4bba89e1d74f9ed07c?variant=devin-insiders
Requested by: @jkelleyrtp