Compare commits

...
2 Commits
Author SHA1 Message Date
radoslaw.smolinski cca2b20c3d 1.5.6 2026-09-28 19:44:34 +02:00
radoslaw.smolinski 105c454d73 Added OG support 2026-09-28 19:44:28 +02:00
6 changed files with 96 additions and 11 deletions
+16 -1
View File
@@ -17,12 +17,27 @@ export type PageMetadata = {
url: string;
}[];
locale?: string;
/** Site/brand name for the OG card. */
siteName?: string;
title: string;
/** 'website' | 'article' etc. Defaults to 'website'. */
type?: string;
/** Canonical URL of this page. */
url?: string;
};
/** robots directives — set to noindex/follow for legal/thin/search pages. */
/**
* robots directives. Indexed pages get generous snippet/preview limits by
* default (Google shows richer results); noindex pages get index:false.
*/
robots?: {
follow: boolean;
index: boolean;
/** 'none' | 'standard' | 'large' — image preview size in results. */
'max-image-preview'?: 'large' | 'none' | 'standard';
/** Max text snippet length; -1 = no limit. Next maps to max-snippet. */
'max-snippet'?: number;
/** Max video preview seconds; -1 = no limit. */
'max-video-preview'?: number;
};
title: string;
};
+20 -4
View File
@@ -71,16 +71,32 @@ import { buildHreflangAlternates } from './hreflang.js';
...images && {
images
},
locale
type: 'website',
locale,
...siteName ? {
siteName
} : {},
...canonical ? {
url: canonical
} : {}
},
// noindex → tell search engines to exclude the page but still follow links
// (authority flows through). For legal/thin/search-result pages.
// robots: noindex pages are excluded (follow keeps link authority). Indexed
// pages get generous snippet/preview limits so Google can show rich results
// (long snippets, large image previews, full video previews).
...meta?.noindex ? {
robots: {
follow: true,
index: false
}
} : {}
} : {
robots: {
follow: true,
index: true,
'max-image-preview': 'large',
'max-snippet': -1,
'max-video-preview': -1
}
}
};
}
File diff suppressed because one or more lines are too long
+25
View File
@@ -843,6 +843,31 @@ const jsonLd = buildArticleJsonLd({
Dane z dokumentu/panelu. Google wymaga headline + dat dla rich result.
## Robots — rich results (max-snippet, image/video preview)
Strony indeksowane dostają automatycznie dyrektywy pozwalające Google na bogate
wyniki (buildMetadata generuje):
- `max-snippet: -1` — pełnej długości snippet (bez limitu)
- `max-image-preview: large` — duży podgląd obrazu w wynikach
- `max-video-preview: -1` — pełny podgląd wideo
Strony noindex (polityki) dostają `index: false, follow: true` — bez powyższych.
Zero konfiguracji — działa automatycznie dla każdej strony przez createPageMetadata.
## Open Graph — pełne pola (type, siteName, url, description)
buildMetadata generuje kompletny OG dla social share (Facebook, LinkedIn, Slack):
- `og:title` — tytuł strony
- `og:description` — meta.description → fallback siteDescription (dziedziczy)
- `og:image` — defaultShareImage / obraz strony
- `og:type` — 'website'
- `og:site_name` — siteName z panelu
- `og:url` — canonical strony
- `og:locale` — język strony
Wszystko z panelu, automatycznie. Opis OG dziedziczy z meta.description (albo
globalnego siteDescription gdy pusty) — patrz niżej.
## Fallback meta description (siteDescription)
Strona bez `meta.description` → plugin używa globalnego `siteDescription` z
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@intecion/ipal-kit",
"version": "1.5.5",
"version": "1.5.6",
"description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
"license": "MIT",
"repository": {
+33 -4
View File
@@ -20,12 +20,27 @@ export type PageMetadata = {
description?: string
images?: { url: string }[]
locale?: string
/** Site/brand name for the OG card. */
siteName?: string
title: string
/** 'website' | 'article' etc. Defaults to 'website'. */
type?: string
/** Canonical URL of this page. */
url?: string
}
/** robots directives — set to noindex/follow for legal/thin/search pages. */
/**
* robots directives. Indexed pages get generous snippet/preview limits by
* default (Google shows richer results); noindex pages get index:false.
*/
robots?: {
follow: boolean
index: boolean
/** 'none' | 'standard' | 'large' — image preview size in results. */
'max-image-preview'?: 'large' | 'none' | 'standard'
/** Max text snippet length; -1 = no limit. Next maps to max-snippet. */
'max-snippet'?: number
/** Max video preview seconds; -1 = no limit. */
'max-video-preview'?: number
}
title: string
}
@@ -140,10 +155,24 @@ export function buildMetadata({
title,
...(description && { description }),
...(images && { images }),
type: 'website',
locale,
...(siteName ? { siteName } : {}),
...(canonical ? { url: canonical } : {}),
},
// noindex → tell search engines to exclude the page but still follow links
// (authority flows through). For legal/thin/search-result pages.
...(meta?.noindex ? { robots: { follow: true, index: false } } : {}),
// robots: noindex pages are excluded (follow keeps link authority). Indexed
// pages get generous snippet/preview limits so Google can show rich results
// (long snippets, large image previews, full video previews).
...(meta?.noindex
? { robots: { follow: true, index: false } }
: {
robots: {
follow: true,
index: true,
'max-image-preview': 'large' as const,
'max-snippet': -1,
'max-video-preview': -1,
},
}),
}
}