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

Edit this page #12

Open
Naramsim opened this issue Sep 27, 2018 · 2 comments
Open

Edit this page #12

Naramsim opened this issue Sep 27, 2018 · 2 comments

Comments

@Naramsim
Copy link
Member

Naramsim commented Sep 27, 2018

We could add in the footer an 'edit this page' link. So that if I am browsing the about page, clicking on this button will redirect me to https://github.com/PokeAPI/pokeapi.co/blob/master/src/pages/about.html.js

An example is vue: https://vuejs.org/v2/guide/ look at the footer

I think it can be done by looking at the URL the user is currently browsing and replacing the base URL with the Github's one. Something like:

`https://github.com/PokeAPI/pokeapi.co/tree/master/src/pages${window.location.pathname}.js`

This will also increase the popularity of this repo 😄

PS: @cmmartti why the about, the v1 and v2 files are named .html.js? While the others are only .js?

@cmmartti
Copy link
Member

So that in the URL, files have *.html, while folders are just bare. That's the idea anyway (I forgot to do it with the status page). I got it from reactjs.org, which is also built on Gatsby. It's not strictly necessary and we can change it back if that's the consensus, but I liked the idea. I also set up redirects in the netlify.toml file, but those are not working while the site is hosted on Digital Ocean.

@cmmartti
Copy link
Member

cmmartti commented Sep 27, 2018

Re: the edit this page link, that's a great idea that we should definitely implement.

However, we can't use window.location.pathname, but we can use Gatsby's (React Router's) location object, which has the same structure. It can be passed into the LayoutFooter component from src/components/Layout.js.

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

2 participants