Built-in statistics (cookieless, consent-gated visitor history); per-page meta descriptions, NoSnippet
Stats: ipalKit({ stats: true }) adds the stats-visits collection, POST /api/ipal/hit, the
/admin/stats view (30-day visits chart, top/entry pages, referrers, devices), a dashboard card
and a nav link. <PageStats> (or <SiteProviders stats>) sends one beacon per page view. Without
consent nothing is stored on the device and no IP is kept: page views are joined by a hash with
an in-memory salt replaced daily. With analytics consent an ipal_vid cookie links visits across
days (server re-checks the consent cookie and policy version; withdrawal deletes the cookie).
Bots, logged-in panel users and prefetches aren't counted. Retention 90 days.
@payloadcms/next added to peerDependencies (DefaultTemplate). Docs: stats.md with privacy text.
Also in this release: meta.description auto-filled from page blocks, <NoSnippet>,
MetaDescriptionCheck in the SEO tab, data-nosnippet on banner/language switcher, GA4 CSP
wildcards, consent version passed to Analytics' default consent.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
305c564d13
commit
4ec27d9ef0
@@ -25,6 +25,39 @@ const titleOverrideField: Field = {
|
||||
localized: true,
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin hint right under meta.description (MetaDescriptionCheck): empty,
|
||||
* same as the site-wide description, or same as another document's.
|
||||
*/
|
||||
function descriptionCheckField(seo: SeoOption): Field | null {
|
||||
if (seo.descriptionCheck === false) {return null}
|
||||
const autoFill =
|
||||
seo.autoFill !== false && (seo.autoFill?.content !== false || Boolean(seo.autoFill?.description))
|
||||
return {
|
||||
name: 'descriptionCheck',
|
||||
type: 'ui',
|
||||
admin: {
|
||||
components: {
|
||||
Field: {
|
||||
clientProps: {
|
||||
autoFill,
|
||||
titleField: (seo.autoFill && seo.autoFill.title) || 'title',
|
||||
...(seo.descriptionCheck ?? {}),
|
||||
},
|
||||
path: '@intecion/ipal-kit/admin#MetaDescriptionCheck',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/** Puts `extra` right after the description field (end of the group if it's missing). */
|
||||
function afterDescription(fields: Field[], extra: Field | null): Field[] {
|
||||
if (!extra) {return fields}
|
||||
const at = fields.findIndex((f) => 'name' in f && f.name === 'description')
|
||||
return at === -1 ? [...fields, extra] : [...fields.slice(0, at + 1), extra, ...fields.slice(at + 1)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures @payloadcms/plugin-seo from IPAL's SeoOption.
|
||||
*
|
||||
@@ -37,7 +70,11 @@ const titleOverrideField: Field = {
|
||||
export function buildSeoPlugin({ seo, uploadsCollection = 'media' }: BuildSeoPluginArgs): Plugin {
|
||||
return seoPlugin({
|
||||
collections: seo.collections,
|
||||
fields: ({ defaultFields }) => [...defaultFields, titleOverrideField, ...(seo.fields ?? [])],
|
||||
fields: ({ defaultFields }) => [
|
||||
...afterDescription(defaultFields, descriptionCheckField(seo)),
|
||||
titleOverrideField,
|
||||
...(seo.fields ?? []),
|
||||
],
|
||||
uploadsCollection,
|
||||
...(seo.generateTitle && { generateTitle: seo.generateTitle }),
|
||||
...(seo.generateDescription && { generateDescription: seo.generateDescription }),
|
||||
|
||||
Reference in New Issue
Block a user