@elytracms/next 0.0.105 → 0.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -3
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -946,15 +946,27 @@ declare function createCanvasRoute(options: CanvasRouteOptions): CanvasRoute;
|
|
|
946
946
|
* defaults live on the project's own settings document and are read by its layout —
|
|
947
947
|
* this reader needs none (EC-590 (b): nothing here ever read a settings document).
|
|
948
948
|
* - `robots`: `seo.noindex` → `{ index: false }`.
|
|
949
|
-
* - `alternates.canonical`: `seo.canonical` (EC-228), verbatim
|
|
949
|
+
* - `alternates.canonical`: `seo.canonical` (EC-228), verbatim — else the page's own ADDRESS,
|
|
950
|
+
* `doc.path` (EC-779): the path the content client puts on the `resolvePage` document, the
|
|
951
|
+
* one router's `urlFor` in the request's locale, so each locale's page names its own
|
|
952
|
+
* localized URL and every duplicate URL of a page (a second route, a trailing slash) names
|
|
953
|
+
* the one address. ROOT-RELATIVE on purpose: Next makes it absolute against the host's
|
|
954
|
+
* `metadataBase` — the host's one declaration of its origin — and keeps an absolute URL over
|
|
955
|
+
* it, so it is never built from `frontendUrl` (a preview deployment's origin on a real site)
|
|
956
|
+
* nor from the request URL. None is inferred on a `noindex` page, nor where the document has
|
|
957
|
+
* no address (a page no route addresses in this locale, a document from `getDocument`). A
|
|
958
|
+
* locale served the default locale's SEO object by fallback never receives its explicit
|
|
959
|
+
* canonical — delivery drops it (`content/resolve.ts`).
|
|
950
960
|
*
|
|
951
961
|
* Image resolution (EC-202/EC-266): `seo.image` is an asset field, delivered as a resolved
|
|
952
962
|
* asset object (`{ id, url, … }`) → its `url`; a string is a passthrough URL or a raw asset
|
|
953
963
|
* id resolved against the page's baked `assets`; anything unresolvable is dropped — an
|
|
954
964
|
* `og:image` must carry a real URL, never an internal id.
|
|
955
965
|
*
|
|
956
|
-
* `hreflang` alternates are intentionally NOT derived here
|
|
957
|
-
* the sitemap's
|
|
966
|
+
* `hreflang` alternates are intentionally NOT derived here: the sitemap is their one emitter
|
|
967
|
+
* (EC-517) — a head emitter would need every locale's client and the sitemap's gates, a second
|
|
968
|
+
* reader of the same facts. What the head carries, its own address, agrees with the sitemap's
|
|
969
|
+
* entry for the page (`sitemap-agreement.test.ts`, EC-779).
|
|
958
970
|
*/
|
|
959
971
|
interface SeoMetadataContext {
|
|
960
972
|
/** The SEO role field name — `result.seoField`. Default: the conventional `seo`. */
|
package/dist/index.js
CHANGED
|
@@ -279,7 +279,9 @@ function seoMetadata(doc, ctx = {}) {
|
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
281
|
if (noindex) metadata.robots = { index: false };
|
|
282
|
-
|
|
282
|
+
const address = noindex ? null : str(doc?.["path"]);
|
|
283
|
+
const effectiveCanonical = canonical ?? address;
|
|
284
|
+
if (effectiveCanonical) metadata.alternates = { canonical: effectiveCanonical };
|
|
283
285
|
return metadata;
|
|
284
286
|
}
|
|
285
287
|
function mergeMetadataOverParent(parent, page) {
|