Question

Subpages of Jekyll-powered static site give 404 on app platform?

I deployed a static Jekyll site on DO App Platform. The site has a number of pages and subpages like /product, /product/product1, /product/product2 etc.

The problem: while the /product page and other top-level pages render great, /product/product1 returns 404 on DigitalOcean app platform, while it works great in local testing.

The permalink is specified like this in product/product1.md YAML front matter:

permalink: "/product/product1"

I should also note that I didn’t use the DO example project to set up the Jekyll project. DO autogenerated everything when I just pointed it to my Jekyll project branch on Github. Everything else seems to work great, just having a problem with some specific subpages.

Is there anything I need to change in my project to get the subpages to render correctly and not return 404?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
January 4, 2021
Accepted Answer

👋🏼 @JaanusK

When running bundle exec jekyll build, is /product/product1 generated as product/product1.html?

If that is the case, what’s happening is that when App Platform gets a request for /product/product1, it looks for either a file named exactly product/product1 or product/product1/index.html—none of which exist.

Mapping /product/product1 to /product/product1.html is something that we’re considering however it is not supported yet.

One solution could be to rename the subpages from product/product1.md to product/product1/index.md. This will generate files like /product/product1/index.html which will work with App Platform. Or, you could run a bash script after jekyll build that goes around and relocates subpages to index.html files under subdirectories.

The other option is to deploy the site as a Service instead of a Static Site. I realize this isn’t very ideal but the built-in Jekyll webserver should be able to handle the permalinks properly without making any changes to the source.

Thank you. Your answer put me on the right track, and I got it fixed. You are right, that /product/product1 was generated as /product/product1.html in the site output. The fix for me was to update the permalinks in the metadata of each page so that instead of permalink: "/product/product1", I would have permalink: "/product/product1/" (one slash added). This made them generated as /product/product1/index.html, so that /product/product1 link (with or without the slash) also works now.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel