Expand description
分享元信息(description / Open Graph / Twitter 卡片)。
分享元信息:description、Open Graph 与 Twitter 卡片。
只有服务端渲染的 HTML 会被社交平台读取,但客户端导航后挂载的标签也要与直达页面一致。
站点信息由中间件放进请求扩展(crate::models::share::ShareContext),
再由 provide_share_context 在 App 根部经 SharedValue 序列化,浏览器水合时读回。
标签顺序固定,以便水合按顺序对齐。
组件只写 <head>、没有可见内容,不进组件图鉴,故为 pub(crate)。
Structs§
- Post
Share 🔒Meta Props - Props for the
PostShareMetacomponent. - Share
Tags 🔒Props - Props for the
ShareTagscomponent. - Site
Share 🔒Meta Props - Props for the
SiteShareMetacomponent.
Functions§
- Post
Share 🔒Meta - 文章页:标题、摘要、文章分享图与发布时间、标签。
- Share
Tags 🔒 - 一组分享标签:description、Open Graph 与 Twitter 卡片(顺序固定,水合按顺序对齐)。
- Site
Share 🔒Meta - 除文章页外的前台页面:站点描述与站点分享图。
- provide_
share_ 🔒context - 应用根组件调用一次:服务端从请求扩展读取分享上下文并序列化进页面,浏览器水合时读回同一份值。
必须在水合期间创建(App 根部):水合结束后才创建的
SharedValue会在浏览器端重新求值,只能得到空值。 - share_
context_ 🔒from_ request - use_
share_ 🔒context - 读取分享上下文;没有上下文时(组件单测)返回空值。