pokeapi.co icon indicating copy to clipboard operation
pokeapi.co copied to clipboard

Edit this page

Open Naramsim opened this issue 6 years ago • 2 comments

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?

Naramsim avatar Sep 27 '18 09:09 Naramsim

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 avatar Sep 27 '18 18:09 cmmartti

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.

cmmartti avatar Sep 27 '18 18:09 cmmartti