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
5 changes: 2 additions & 3 deletions apps/svelte.dev/src/lib/components/PageControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

interface Props {
repo: string;
path: string;
prev: null | {
path: string;
title: string;
Expand All @@ -14,11 +13,11 @@
};
}

let { repo, path, prev, next }: Props = $props();
let { repo, prev, next }: Props = $props();
</script>

<p class="edit">
<a href="{repo}/edit/main/{path}">
<a href={repo}>
<Icon name="edit" /> Edit this page on GitHub
</a>
</p>
Expand Down
9 changes: 7 additions & 2 deletions apps/svelte.dev/src/routes/docs/[...path]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
setupDocsHovers();

let content = $state() as HTMLElement;

const repo = $derived.by(() => {
const name = data.document.slug.split('/')[1];
const link = 'docs/' + data.document.file.split('/').slice(2).join('/');
return `https://github.com/sveltejs/${name}/edit/main/documentation/${link}`;
});
</script>

<svelte:head>
Expand Down Expand Up @@ -40,8 +46,7 @@
</div>

<PageControls
repo="https://github.com/sveltejs/svelte.dev"
path="apps/svelte.dev/content/{data.document.file}"
{repo}
prev={data.document.prev && {
title: data.document.prev.title,
path: `/${data.document.prev.slug}`
Expand Down
3 changes: 1 addition & 2 deletions apps/svelte.dev/src/routes/tutorial/[...slug]/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
</div>

<PageControls
repo="https://github.com/sveltejs/svelte.dev"
path="apps/svelte.dev/content/{exercise.dir}"
repo="https://github.com/sveltejs/svelte.dev/edit/main/apps/svelte.dev/content/{exercise.dir}"
prev={exercise.prev && {
title: exercise.prev.title,
path: `/tutorial/${exercise.prev.slug}`
Expand Down
Loading