Skip to content

Commit f569be1

Browse files
cnunciatoclaude
andauthored
Restore "Edit this Page" link for editable docs pages (#20900)
* Restore "Edit this Page" link for editable docs pages Bring back the right-rail "Edit this Page" link that was dropped in #19855, but only surface it on pages a reader can actually edit in this repo. Rather than the stale path-prefix checks the old version used (the CLI and reference-doc paths have since moved), suppression is driven by signals that stay correct as content moves: - generated pages are detected by the "Auto generated by ..." marker they carry (the same signal scripts/lint/lint-markdown.js already trusts), - registry package docs are excluded since they're built from pulumi/registry, - no_edit_this_page: true remains a manual per-page opt-out. The link uses the docs semantic color tokens so it reads correctly in both light and dark mode. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Anchor registry edit-link guard to the path prefix The previous strings.Contains "registry/" check matched any permalink containing that substring — including /docs/idp/concepts/private-registry/, which wrongly suppressed the edit link. Use hasPrefix on .File.Path so only the top-level registry/ section (built from pulumi/registry) is excluded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Drop the registry edit-link guard Everything under /registry is built and deployed from pulumi/registry, so no page in this repo renders through this partial with a registry/ path. The guard was dead code; remove it. Suppression now rests on the auto-generated marker and the no_edit_this_page opt-out. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 510dad1 commit f569be1

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

layouts/partials/docs/table-of-contents.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ <h2 class="no-anchor">On this page</h2>
5757
{{ end }}
5858
<ul class="p-0 list-none table-of-contents-feedback">
5959
{{ if .File }}
60+
{{/* Hide "Edit this Page" for pages that aren't editable here: generated
61+
pages carry the "Auto generated by ..." marker (the same signal the
62+
linter uses), and no_edit_this_page is a manual opt-out. */}}
63+
{{ $generated := findRE "###### Auto generated by" .RawContent 1 }}
64+
{{ if not (or $generated $.Page.Params.no_edit_this_page) }}
65+
<li>
66+
<a
67+
data-track="edit-page"
68+
class="text-docs-fg-muted hover:text-docs-fg text-xs no-underline"
69+
href="{{ $.Site.Params.contentRepositoryURL }}/edit/{{ $.Site.Params.contentRepositoryBaseBranch }}/content/{{ .File.Path }}"
70+
target="_blank"
71+
>
72+
{{ partial "icon.html" (dict "name" "pencil-simple" "class" "mr-2") }}Edit this Page
73+
</a>
74+
</li>
75+
{{ end }}
6076
<li>
6177
<a
6278
data-track="request-change"

0 commit comments

Comments
 (0)