Deploying SSG to Gitlab Pages #26231
Unanswered
soykje
asked this question in
Show and tell
Replies: 1 comment 1 reply
-
Hey @soykje could you share your .gitlab-ci.yml file? I am trying to get a site deployed on pages and can't seem to figure it out. Thanks! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone 👋
No troll here... But I like Gitlab, and Gitlab Pages 🙂 So naturally my personal website was hosted with this solution, and I had no reason to change, even when I decided to rewrite the code using Next.js 🎉
Besides the
assetPrefix
configuration (such asassetPrefix: isProd ? '/' : ''
for user page), I was having an issue with some 503... which I was able to solve using thetrailingSlash
option. As I may not be the only one using Gitlab Pages with Next.js SSG, it may be helpful to explain the reasons of thistrailingSlash
fix...After inspecting my output directory, with and without the
trailingSlash
option, I realized that something could be in cause... Without the option, I get a folder structure as follows:With
trailingSlash
enabled, I get:Gitlab Pages resolves urls in a certain way, and this is why my first option didn't work in this case... I finally got it!
tldr; If you're deploying your project on Gitlab Pages, you may have to enable
trailingSlash
, to remove ambiguous urls.The last problem I'm actually facing, is with custom 404 page: with trailing slashes it is exported as
404/index.html
, which doesn't matches Gitlab Pages requirements... For now I only found a workaround solution, by moving and renaming my output file as404.html
😞Don't know if there could be a better way to do so... Nevertheless it still doesn't work, as Gitlab Pages redirects to authentification page when I try to call my 404 🤯
Beta Was this translation helpful? Give feedback.
All reactions