# \[DocC\] Add @EditLink metadata directive for article “Edit this Page” links

**URL:** <https://forums.swift.org/t/docc-add-editlink-metadata-directive-for-article-edit-this-page-links/85741>\
**Category:** Swift-DocC\
**Created:** [March 31, 2026, 8:02pm UTC](https://forums.swift.org/t/docc-add-editlink-metadata-directive-for-article-edit-this-page-links/85741 "2026-03-31T20:02:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Himadrimani](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/himadrimani/32/44941_2.png) [@Himadrimani](https://forums.swift.org/u/Himadrimani)\
**Post date:** [March 31, 2026, 8:02pm UTC](https://forums.swift.org/t/docc-add-editlink-metadata-directive-for-article-edit-this-page-links/85741/1 "2026-03-31T20:02:19Z")

</div>

I’m proposing a new DocC metadata directive: @EditLink(url:), with optional @EditLink(isDisabled:).

Motivation:

- Allow manual per-article control of “Edit this Page” link.
- Current automatic SourceRepository mapping works globally, but some pages need explicit override or disable behavior.

This is currently implemented in PR:

> <https://github.com/swiftlang/swift-docc/pull/1494>
>
> \## Summary
> Implements #1435 — automatic "Edit this Page" links for article page…s
> when a \`SourceRepository\` is configured, plus a new \`@EditLink\` metadata
> directive for manual control.
> 
> Changes
> \- 'Article.swift': Persist \`source: URL?\` so the rendering layer
> can map articles back to their on-disk location.
> \- 'EditLink.swift': \`@EditLink(url:)\` / \`@EditLink(isDisabled:)\`
> directive inside \`@Metadata\`.
> \- 'Metadata.swift': Register \`@EditLink\` as a child directive and
> include it in the empty-metadata validation check.
> \- 'RenderNodeTranslator.visitArticle': Populate
> \`RenderMetadata.remoteSource\` using the directive or automatic
> \`SourceRepository\` mapping — mirrors the existing \`visitSymbol\` logic.
> \- 'DocumentationContext', 'ReferenceResolver',
> 'GeneratedDocumentationTopics': Thread \`source:\` through all
> 'Article' initialisation call-sites.
> Usage
> Automatic (no directive needed)
> When a \`SourceRepository\` is configured the rendered page automatically
> gets an edit link.
> 
> Manual override
> \`\`\`markdown
> @Metadata {
> @EditLink(url: "https://github.com/org/repo/edit/main/Docs/MyPage.md")
> }

Question for feedback:

- Is adding this user-facing syntax acceptable?
- Should this be directive-based, or handled another way?

---

<div class="post-metadata">

**Author:** ![ronnqvist](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ronnqvist/32/20110_2.png) [@ronnqvist](https://forums.swift.org/u/ronnqvist)\
**Post date:** [April 1, 2026, 9:08am UTC](https://forums.swift.org/t/docc-add-editlink-metadata-directive-for-article-edit-this-page-links/85741/2 "2026-04-01T09:08:53Z")

</div>

Hi,  
There's a fair amount of information missing from this post that makes it difficult to have a meaningful discussion about the proposed addition.

[This message](https://forums.swift.org/t/experimental-documentation-coverage/77489/5) briefly summarizes the evolution process for DocC and links to several pitches/proposals—from both people who contribute to DocC frequently and people who are first time contributors—that you can use as inspiration when writing your own pitch/proposal.

* * *

At this stage in the discussion, the implementation is less relevant. Instead, it would be good to focus the discussion on:

- What is the problem statement that this is solving?
- How does the proposed solution solve that problem?
- Details about any user-facing syntax that the proposed solution would introduce
- A brief description of one or more viable alternatives and why the proposed solution solves the stated problem better than those alternatives
- Any open questions that need to be discussed where the pitch/proposal doesn't make a specific recommendation.

Please update your proposal to have a short section for each of those topics so that it's easier for the community to discuss the proposal.
