Opt-outs for the secure defaults; isPathVisibleIn in construction/logic
- setUnknownIpFactor (0 = old free pass), UNKNOWN_IP_FACTOR exported
- createContentHelpers({ settingsDepth }) and markdown/mcp isPathVisible overrides
- <RenderRichText safeLinks={false}>
- resolveRedirect({ draft: true }) for preview
- isPathVisibleIn(mode, path), pathOf, PathVisibility exported; page route uses it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4585e0fc69
commit
0fd57c1d6a
@@ -16,7 +16,7 @@ import type { PageMetadata, RobotsOptions, RobotsRules, SitemapEntry, SitemapSty
|
||||
|
||||
import { getAnalyticsConfig } from '../analytics/getAnalyticsConfig.js'
|
||||
import { getConsentTexts } from '../consent/getConsentTexts.js'
|
||||
import { isPathAllowed } from '../construction/logic.js'
|
||||
import { isPathVisibleIn } from '../construction/logic.js'
|
||||
import { createMarkdownRoute } from '../content/createMarkdownRenderer.js'
|
||||
import { getArchiveEntries, resolveRoute as resolveRouteRaw } from '../content/index.js'
|
||||
import { MARKDOWN_PREFIX, markdownHref } from '../content/markdownNegotiation.js'
|
||||
@@ -55,7 +55,7 @@ type CreateContentHelpersArgs = {
|
||||
*/
|
||||
i18n?: I18nConfig
|
||||
/** Markdown route (`markdownRoute`): per-block overrides, frontmatter, layout field. */
|
||||
markdown?: { frontmatter?: boolean; layoutField?: string; overrides?: Record<string, (block: Record<string, unknown>) => string> }
|
||||
markdown?: { frontmatter?: boolean; isPathVisible?: PathVisibility; layoutField?: string; overrides?: Record<string, (block: Record<string, unknown>) => string> }
|
||||
/**
|
||||
* Advertise each page's Markdown version from generatePageMetadata:
|
||||
* `<link rel="alternate" type="text/markdown" href="/md/pl/o-nas">` (GEO —
|
||||
@@ -65,7 +65,7 @@ type CreateContentHelpersArgs = {
|
||||
*/
|
||||
markdownAlternate?: boolean | string
|
||||
/** MCP route (`mcpRoute`): server name/version, rate limit, batch size. */
|
||||
mcp?: Pick<CreateMcpRouteArgs, 'clientIp' | 'maxBatch' | 'rateLimit' | 'serverName' | 'serverVersion'>
|
||||
mcp?: Pick<CreateMcpRouteArgs, 'clientIp' | 'isPathVisible' | 'maxBatch' | 'rateLimit' | 'serverName' | 'serverVersion'>
|
||||
/** Defaults for getPageJsonLd — each call can override them. */
|
||||
pageJsonLd?: PageJsonLdOptions
|
||||
/** Pages collection slug. Defaults to 'pages'. */
|
||||
@@ -78,6 +78,12 @@ type CreateContentHelpersArgs = {
|
||||
* `{ adminRoute: false }` when the admin path is hidden (ipalKit adminRoute).
|
||||
*/
|
||||
robots?: RobotsOptions
|
||||
/**
|
||||
* Depth of the Site Settings read behind getSettings / getSiteShell. Default
|
||||
* 1 (relations as documents, their relations as ids). Raise it only if your
|
||||
* layout reads deeper — every request pays for it.
|
||||
*/
|
||||
settingsDepth?: number
|
||||
/** SiteSettings global slug. Defaults to 'site-settings'. */
|
||||
settingsSlug?: string
|
||||
/**
|
||||
@@ -171,6 +177,7 @@ export function createContentHelpers({
|
||||
pagesSlug = 'pages',
|
||||
redirectCollections,
|
||||
robots: robotsOptions,
|
||||
settingsDepth = 1,
|
||||
settingsSlug = 'site-settings',
|
||||
siteJsonLd,
|
||||
sitemapImages,
|
||||
@@ -198,7 +205,7 @@ export function createContentHelpers({
|
||||
*/
|
||||
const getSettings = cache(async (locale: string) => {
|
||||
const payload = await getCachedPayload()
|
||||
return payload.findGlobal({ slug: settingsSlug as never, depth: 1, locale: locale as never })
|
||||
return payload.findGlobal({ slug: settingsSlug as never, depth: settingsDepth, locale: locale as never })
|
||||
})
|
||||
|
||||
/** What does this URL point at? Routing only — no listing data. */
|
||||
@@ -691,10 +698,7 @@ export function createContentHelpers({
|
||||
* Is this page path public right now? False for pages construction mode
|
||||
* hides. The Markdown and MCP routes use it; pass it to createSearchRoute.
|
||||
*/
|
||||
const isPathVisible: PathVisibility = async (path, locale) => {
|
||||
const construction = await getConstructionMode(locale)
|
||||
return !construction.enabled || isPathAllowed(path, construction.allowedPaths)
|
||||
}
|
||||
const isPathVisible: PathVisibility = async (path, locale) => isPathVisibleIn(await getConstructionMode(locale), path)
|
||||
|
||||
// ── Layout ────────────────────────────────────────────────────────────────
|
||||
/** Notifications → form texts in this locale (BuilderForm / RenderForm `texts`). */
|
||||
|
||||
Reference in New Issue
Block a user