Mdx-deck: Deploy to gh-pages

Created on 1 Nov 2019  ·  9Comments  ·  Source: jxnblk/mdx-deck

Is there a way to make it work with gh-pages branch.
problem is that links in generated index.html are relative from a domain (starts with /)
<link as="script" rel="preload" href="/commons-cb11f4ecc482359b7fd0.js"/>
And gh-pages branch served form https://<username>.github.io/<project-name>/ which will resolve to https://username.github.io/commons-cb11f4ecc482359b7fd0.js and won't work.

Path prefix form gatsby settings should solve the problem https://www.gatsbyjs.org/docs/path-prefix/

Most helpful comment

@isBatak
I came up with a gh setup starter here https://github.com/pengx17/slides, you can fork it and try yourself.

@jxnblk I think we could add a new template using my boilerplate to create-deck cli besides the basic one for advanced users.

All 9 comments

You should be able to use pathPrefix & --prefix-paths with the Gatsby theme

🤔 I'm not sure I understand...
I can try to add gatsby-config.js in the root

module.exports = {
  pathPrefix: `/<project-name>`,
}

but where should I put--prefix-paths?
I tried mdx-deck build deck.mdx --prefix-paths but it isn't working :)

I think you'll need to use the theme directly instead of using mdx-deck, see https://github.com/jxnblk/mdx-deck/tree/master/packages/gatsby-theme

Thanks so much! I was about to open the same issue and submit a PR that was probably overkill. Can you recommend a good place to add this to the docs? Not sure I would have ever discovered it on my own. Happy to submit a PR.

Maybe add a link to DOCS list under Usage with Gatsby called Deploy to GitHub pages or something similar

@isBatak
I came up with a gh setup starter here https://github.com/pengx17/slides, you can fork it and try yourself.

@jxnblk I think we could add a new template using my boilerplate to create-deck cli besides the basic one for advanced users.

I was able to deploy my slide-deck to github pages as well! Which is published here https://fullstackzach.com/git-talk/

here's a reference to my working repo. https://github.com/fullstackzach/git-talk

I thought I'd share as another setup reference. Thanks to @pengx17 for the example!

@pengx17 I followed your starter here, https://github.com/pengx17/slides, and was able to get my site working on Github Pages, but I noticed that the Theme UI customizations I had made don't end up in the build. Would you have any thoughts on why that might be? I'm not very familiar with Gatsby.

Also, thanks for pointing to the starter repo! It was really helpful.

Hello ✋
I ran into this error too,

Yesterday I’ve tried to fix this, and when adding pathPrefix in the gatsby-config.js all the paths seem right.

But (there is always a “but”) there is something in the router that point always at the root (probably the webpack configuration?), have some ideas about that?

BTW I've hardcoded in my bundle the broken paths and now works,
here proof: 😆
http://tomma5o.com/slides/introToReactThreeFiber

Was this page helpful?
0 / 5 - 0 ratings

Related issues

broccolini picture broccolini  ·  4Comments

trevordmiller picture trevordmiller  ·  3Comments

wpannell picture wpannell  ·  4Comments

sibelius picture sibelius  ·  3Comments

DSchau picture DSchau  ·  5Comments