CTA: register default templates on docset.yml and toc.yml - #3716
Open
bmorelli25 wants to merge 3 commits into
Open
CTA: register default templates on docset.yml and toc.yml#3716bmorelli25 wants to merge 3 commits into
bmorelli25 wants to merge 3 commits into
Conversation
Docsets can now apply a right-gutter CTA template to an entire path subtree by listing docset-relative prefixes under a template's 'paths' key, instead of adding 'cta' frontmatter to every page. Resolution order: explicit frontmatter id, then the longest matching path prefix, then the built-in trial default. An unknown frontmatter id warns and is ignored so path scopes still apply. A path claimed by two templates is a build error. Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
@elastic/docs-engineering I have this proposal for you. If it's too far from your vision LMK and we can close this. |
2 tasks
Member
|
drive by comment, would registering the default cta in toc.yml suffice? |
Replace cta.<name>.paths in docset.yml with default_cta on docset.yml and nested toc.yml so section owners register defaults alongside their nav trees. Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve docs conflict: navigation reference moved to docs/documentation/isolated/configure/index.md; port default_cta docs there and drop deleted configure/content-set/navigation.md. Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
I've realigned this PR with your suggestion 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The right-gutter CTA card can now be customized per page via
ctafrontmatter (see #3602).Why is something more needed?
elastic/docs-content-internal#1475 requests adding a custom "Get started free" CTA and
onboarding_tokento all solution-specific pages undersolutions/observability/,solutions/security/, andsolutions/search. Doing this in frontmatter alone means editing ~600 files. Over time as new pages are added, folks will inevitably forget the frontmatter and we'll end up with an inconsistent mix of CTAs.The proposed solution
Register a default CTA on the navigation file that owns a section. Templates still live in
docset.yml;default_ctaondocset.ymlor a nestedtoc.ymlselects which template applies to every page listed in that file.Resolution order for a page:
ctafrontmatter id (unchanged, always wins)default_ctaregistered for the page via its navigation filetrialdefaultThis makes the docs-content side of #1475 a small change across
docset.ymlplus a few sectiontoc.ymlfiles. Pages that already carryctafrontmatter (e.g. themonitor-kubernetes/monitor-awspages from elastic/docs-content#7135) keep their more specific CTA automatically.Details: inheritance, edge cases, and one behavior change
toc.ymlpick up itsdefault_ctaautomatically.toc.ymlcan set its owndefault_cta; pages under it use that value instead of the parent navigation file's default.default_ctathat doesn't match a template indocset.yml, fails the build rather than resolving silently.ctaid warned and fell back straight to the defaulttrialcard. It still warns, but is now ignored, so a navigation default covering the page applies instead. The section CTA is more relevant than the generic card, and the warning still points at the typo.Docs for the new key are added to
docs/configure/content-set/cta.mdanddocs/configure/content-set/navigation.md.Test plan
ConfigurationFileCtaTestscovering precedence, nested toc overrides, docset-level defaults, unknown template errors, and duplicate registration errorsdefault_ctaon a sectiontoc.ymlrenders the scoped CTA on pages in that nav file and the default elsewhere