Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Edit this page" button (leads to 404) #407

Open
maxheld83 opened this issue Jan 22, 2025 · 1 comment
Open

Fix "Edit this page" button (leads to 404) #407

maxheld83 opened this issue Jan 22, 2025 · 1 comment

Comments

@maxheld83
Copy link

maxheld83 commented Jan 22, 2025

The "Edit this page" button currently leads to a 404, as first reported in #391

The web UI currently gives this for https://zero-to-nix.com/start/nix-develop/, for example:

https://github.com/DeterminateSystems/zero-to-nix/edit/main/src/content/start/nix-develop/.mdx

The Correct URL would be:

https://github.com/DeterminateSystems/zero-to-nix/edit/main/src/content/start/3.nix-develop.mdx

So, it seems like the filename is bad.

@maxheld83
Copy link
Author

I think this is the bug:

const filename = Astro.url.pathname;
const issueTitle = `Issue with page \`${filename}\``;
const issueBody = `...Replace me with your issue description...`;
const issueUrlParams = `title=${issueTitle}&body=${issueBody}`;
const issueUrl = `${githubUrl}/issues/new?${encodeURI(issueUrlParams)}`;
const editUrl = `${githubUrl}/edit/main/src/content${filename}.mdx`;

filename is the url path (which doesn't have the starting 3.).

I'm not sure what the idiomatic/intended file/url naming scheme is here, so I'll leave this for someone else to fix who knows more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant