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

Example permalinks don't work #59

Closed
shawnbot opened this issue Jun 7, 2018 · 4 comments
Closed

Example permalinks don't work #59

shawnbot opened this issue Jun 7, 2018 · 4 comments
Labels
bug Something isn't working 💓collab a vibrant hub of collaboration ⭐️rep an industry leading reputation

Comments

@shawnbot
Copy link
Contributor

shawnbot commented Jun 7, 2018

Our x0-driven docs site doesn't generate working component permalinks. When we publish to Pages, the index loads from /primer-react/, but the links all go to /{ComponentName} (without the right path prefix). The pages for individual components don't even really exist (there's only an index.html in the docs directory), so I'm not sure what the URLs really should be for a component example. Having working permalinks seems pretty crucial to me.

To reproduce, visit https://primer.github.io/primer-react/ and click on "Details". The URL changes to https://primer.github.io/Details, which doesn't exist. But neither do any of the following:

  • https://primer.github.io/primer-react/Details
  • https://primer.github.io/primer-react/?Details
  • https://primer.github.io/primer-react/#Details

We've already set x0.basename in package.json as described in x0's docs, but the URLs that are getting passed to location.replace() or history.pushState() just aren't right.

Any ideas, @broccolini?

@shawnbot shawnbot added bug Something isn't working 💓collab a vibrant hub of collaboration ⭐️rep an industry leading reputation labels Jun 7, 2018
@shawnbot
Copy link
Contributor Author

Some notes here after trying out Next.js in #64 and then switching back to using x0 in #65 with examples broken out into individual files:

  1. Next was great up until I tried exporting the site and ran into a bunch of issues with component examples that use Kit's <Details> element. I ended up having to comment those out to get it exporting.
  2. I much prefer the way that Next allows you to customize the HTML template to how x0 does it: Next does it in React, but x0 does it with a function that takes a bunch of props but returns a string (presumably so that you can change the doctype?).
  3. Both x0 and Next.js support filesystem-based routing and exports, but I couldn't get either to work the way I expected/wanted them to. 🤔

This was referenced Jun 18, 2018
@emplums emplums mentioned this issue Jun 21, 2018
8 tasks
@emplums
Copy link

emplums commented Jun 22, 2018

Update: I got routing working as we'd like, but even when examples route to /primer-react/components/Box, the permalink still doesn't work ☹️ I suspect it's because x0 doesn't generate static html files for each of the examples, they're all being visually rendered with the js in the bundle, maybe?

@broccolini
Copy link
Member

Did you try this? #84 (comment)

@shawnbot
Copy link
Contributor Author

Hey hey, this works! E.g. https://primer.github.io/primer-react/components/Details 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 💓collab a vibrant hub of collaboration ⭐️rep an industry leading reputation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants