Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"format": "biome format --write .",
"format:check": "biome format src integrations plugins scripts",
"check": "astro check && eslint . && biome check .",
"check:links": "linkinator dist/ --recurse --retry-errors --retry-errors-count 3 --timeout 30000 --concurrency 25 --verbosity error"
"check:links": "linkinator dist/ --recurse --retry-errors --retry-errors-count 3 --timeout 30000 --concurrency 25 --verbosity error --skip 'github.com/.*/edit/'"
},
"devDependencies": {
"@actions/core": "^3.0.0",
Expand Down
57 changes: 57 additions & 0 deletions src/components/PageMeta.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
/**
* Displays "Edit this page" link and "Last updated" timestamp
* at the bottom of documentation pages.
*/
import { Icon } from 'astro-icon/components';

export interface Props {
pathname: string;
}

const { pathname } = Astro.props;

const GITHUB_EDIT_BASE = 'https://github.com/Mergifyio/docs/edit/main/src/content/docs';

function getEditPath(pathname: string): string {
const trimmed = pathname === '/' ? '/index' : pathname.replace(/\/$/, '') || '/index';
return `${GITHUB_EDIT_BASE}${trimmed}.mdx`;
}

const editUrl = getEditPath(pathname);
---

<div class="page-meta">
<a class="page-meta__edit" href={editUrl} target="_blank" rel="noopener noreferrer">
<Icon name="feather:edit-2" width={14} height={14} />
<span>Edit this page on GitHub</span>
</a>
</div>

<style>
.page-meta {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 1.5rem;
flex-wrap: wrap;
margin-top: 3rem;
padding-top: 1.5rem;
border-top: 1px solid var(--theme-divider);
font-size: var(--theme-text-sm);
color: var(--theme-text-lighter);
}

.page-meta__edit {
display: inline-flex;
align-items: center;
gap: 0.4rem;
color: var(--theme-text-lighter);
text-decoration: none;
transition: color 0.15s ease;
}

.page-meta__edit:hover {
color: var(--color-mergify-blue);
}
</style>
2 changes: 2 additions & 0 deletions src/layouts/MainLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Breadcrumbs from '../components/Breadcrumbs.astro';
import CopyForLLMButton from '../components/CopyForLLMButton.astro';
import PageContent from '../components/PageContent/PageContent.astro';
import PageFeedback from '../components/PageFeedback.astro';
import PageMeta from '../components/PageMeta.astro';
import RightSidebar from '../components/RightSidebar/RightSidebar.astro';
import TableOfContents from '../components/RightSidebar/TableOfContents';
import ViewMarkdownButton from '../components/ViewMarkdownButton.astro';
Expand Down Expand Up @@ -61,6 +62,7 @@ const { content, headings, breadcrumbTitle, showMarkdownActions = true } = Astro
Astro.url.pathname !== '/' && (
<Fragment slot="after-content">
<PageFeedback />
<PageMeta pathname={Astro.url.pathname} />
</Fragment>
)
}
Expand Down