Skip to content

Commit 06559e4

Browse files
authored
Merge of #10315
2 parents ddf1f3f + 7f4eba3 commit 06559e4

3 files changed

Lines changed: 60 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"format": "biome format --write .",
1414
"format:check": "biome format src integrations plugins scripts",
1515
"check": "astro check && eslint . && biome check .",
16-
"check:links": "linkinator dist/ --recurse --retry-errors --retry-errors-count 3 --timeout 30000 --concurrency 25 --verbosity error"
16+
"check:links": "linkinator dist/ --recurse --retry-errors --retry-errors-count 3 --timeout 30000 --concurrency 25 --verbosity error --skip 'github.com/.*/edit/'"
1717
},
1818
"devDependencies": {
1919
"@actions/core": "^3.0.0",

src/components/PageMeta.astro

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
/**
3+
* Displays "Edit this page" link and "Last updated" timestamp
4+
* at the bottom of documentation pages.
5+
*/
6+
import { Icon } from 'astro-icon/components';
7+
8+
export interface Props {
9+
pathname: string;
10+
}
11+
12+
const { pathname } = Astro.props;
13+
14+
const GITHUB_EDIT_BASE = 'https://github.com/Mergifyio/docs/edit/main/src/content/docs';
15+
16+
function getEditPath(pathname: string): string {
17+
const trimmed = pathname === '/' ? '/index' : pathname.replace(/\/$/, '') || '/index';
18+
return `${GITHUB_EDIT_BASE}${trimmed}.mdx`;
19+
}
20+
21+
const editUrl = getEditPath(pathname);
22+
---
23+
24+
<div class="page-meta">
25+
<a class="page-meta__edit" href={editUrl} target="_blank" rel="noopener noreferrer">
26+
<Icon name="feather:edit-2" width={14} height={14} />
27+
<span>Edit this page on GitHub</span>
28+
</a>
29+
</div>
30+
31+
<style>
32+
.page-meta {
33+
display: flex;
34+
align-items: center;
35+
justify-content: flex-start;
36+
gap: 1.5rem;
37+
flex-wrap: wrap;
38+
margin-top: 3rem;
39+
padding-top: 1.5rem;
40+
border-top: 1px solid var(--theme-divider);
41+
font-size: var(--theme-text-sm);
42+
color: var(--theme-text-lighter);
43+
}
44+
45+
.page-meta__edit {
46+
display: inline-flex;
47+
align-items: center;
48+
gap: 0.4rem;
49+
color: var(--theme-text-lighter);
50+
text-decoration: none;
51+
transition: color 0.15s ease;
52+
}
53+
54+
.page-meta__edit:hover {
55+
color: var(--color-mergify-blue);
56+
}
57+
</style>

src/layouts/MainLayout.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Breadcrumbs from '../components/Breadcrumbs.astro';
66
import CopyForLLMButton from '../components/CopyForLLMButton.astro';
77
import PageContent from '../components/PageContent/PageContent.astro';
88
import PageFeedback from '../components/PageFeedback.astro';
9+
import PageMeta from '../components/PageMeta.astro';
910
import RightSidebar from '../components/RightSidebar/RightSidebar.astro';
1011
import TableOfContents from '../components/RightSidebar/TableOfContents';
1112
import ViewMarkdownButton from '../components/ViewMarkdownButton.astro';
@@ -61,6 +62,7 @@ const { content, headings, breadcrumbTitle, showMarkdownActions = true } = Astro
6162
Astro.url.pathname !== '/' && (
6263
<Fragment slot="after-content">
6364
<PageFeedback />
65+
<PageMeta pathname={Astro.url.pathname} />
6466
</Fragment>
6567
)
6668
}

0 commit comments

Comments
 (0)