Nina
Nina

Reputation: 103

Pretty permalinks don't work with GitHub Pages

Pretty permalinks are working file locally but not once deployed to GitHub Pages. Puzzled what might be a reason. Pages can be still accessed via .html.

_config.yml

title: Project Name
baseurl: /project-name
url: "http://organization-name.github.io"
google_analytics: # set tracking

gems:
  - jekyll-redirect-from

exclude:
 - Gemfile
 - Gemfile.lock

permalinks: pretty
markdown: kramdown

Gemfile

source "https://rubygems.org"
ruby RUBY_VERSION

gem "github-pages", group: :jekyll_plugins

group :jekyll_plugins do
end

Upvotes: 2

Views: 1092

Answers (3)

David Jacquel
David Jacquel

Reputation: 52829

The right syntax is permalink: pretty : singular.

Upvotes: 2

YaFred
YaFred

Reputation: 10018

You have to modify your _config.yml

defaults:
-
   scope:
     path: ""
     type: "pages"
   values:
     permalink: "/:basename/"

You may want to tweak this example.

For example, if you want to keep your folder structure in your permalinks, you could have:

defaults:
-
   scope:
     path: ""
     type: "pages"
   values:
     permalink: "/:path/:basename/"

Note: "pretty" is "/:path/:basename/"

Upvotes: 1

Nina
Nina

Reputation: 103

So I solved this issue by adding permalink explicitly to page meta. E.g.

permalink: /about/

Strange that it is not required locally.

Upvotes: 1

Related Questions