跳到主要内容

当前 Web Device source

目录与文件约定参考

按职责定位每一项公开 Web Device 约定,而不是复制一棵历史目录树。

需要精确位置时看本页。它是当前目录读取合同,不代表每个历史站点都已经迁移到这一形状。

站点根目录

路径职责
.route/web声明 blocklet 为本地或已发布 runtime 提供 Web entry
.web/site.yaml站点级标量配置:locale、SEO、template/theme 值及相关设置
.web/tokens.json浅色/默认 design token 与可选 dark 覆盖
.web/redirects独立的逐行 redirect rule 文件
.web/template/logo.svg站点 logo asset
.web/components/<name>/可复用的站点呈现 component
.web/themes/本地 theme material;它和 shared-library fallback 有独立的优先级规则
layouts/<name>.aup由内容对象 front matter 的 layout: <name> 选择的 named object layout;它不会产生 route

页面

路径职责
pages/index/首页 entry point
pages/<name>/layout.aup默认页面 layout source
pages/<name>/layout.<locale>.aup只有 layout 确实不同才使用的 locale-specific source
pages/<name>/seo/title / description默认页面 metadata
pages/<name>/seo/title.<locale> / description.<locale>locale-specific 页面 metadata
pages/<name>/sources/<source>该页面 scope 的内容 source path
`pages//sources/.sort.limit.filter`可选的 source selection control

layout 的读取顺序为 locale AUP、默认 AUP、locale JSON、默认 JSON、再到 convention/default layout。新 source 应使用 AUP 形式,除非已核验的兼容消费者要求 JSON。

内容对象

路径职责
content/<type>/<slug>/content.md默认读者正文与 front matter
content/<type>/<slug>/content.<locale>.mdlocale-specific 正文
content/<type>/<slug>/layout.aup对象确实需要时的 object-specific layout

content.md 与兼容的 index.md 同时存在时会优先。front matter 的 metadata 优先级高于 sibling field file。一个对象只能选择自己的 layout.aup 或通过 layout: <name> 选择 layouts/<name>.aup,不能同时使用。正文与对象身份应留在这里,不要复制到页面 layout。

locale support 文件

.aup/locales/*.json 可以提供兼容 locale fallback。新的 multi-locale site 应在 .web/site.yaml 显式声明 localelocales,随后把 locale variant 放在被覆盖的事物旁,而不是复制整棵目录。

目录的语义见 理解站点目录;路由影响见 路由与语言参考