laurilehmijoki/s3_website

Need to remove .html from files?

peavers opened this issue · 4 comments

Hello,

I can't access anything but the homepage without adding .html to the end of the url. For example example.com/posts returns a 404 but example.com/posts.html returns the page.

I'm using cloudfront but everything (including the creation of the bucket) was handled with S3, and the posts.html file has the correct content-type set, am I just missing something obvious here?

Surely I don't have to create redirect rules in the config for every single page do I?

You should not have to create redirect rules in this kind of a case. Do your local files end with the .html suffix? If yes, then try removing the suffix.

Hmm I'm brand new to Jekyll so this could contribute to my issues...

I have posts.md which contains standard Jekyll stuff, I've just tried removing the .html from the permalink but still no deal. posts.md contains the following

---
layout: post-list
title: Posts
description: "List of posts"
permalink: /posts.html
---

posts.md ends up being posts.html in the s3 bucket after building and pushing;

@peavers change permalink from /posts.html to /posts/!

Using a trailing slash for the Jekyll permalink will get the URLs to work (by creating an index.html for the page in a subfolder), but the only problem with this is that if you visit the URL without the trailing slash, S3 does a 302 redirect to the trailing slash version. Not ideal, but I'm hoping that with rel=canonical meta tags added, and ensuring you are always linking to the trailing slash version.... it should be okay from an SEO standpoint? Any ideas?

Relevant discussion here: #233