thecdil / timelinejs-template

https://thecdil.github.io/timelinejs-template/
MIT License
15 stars 4 forks source link

Nav links at the top of the page would be better without the .html suffix #9

Open paul-hammant opened 3 years ago

paul-hammant commented 3 years ago

See https://its-airborne.org/

Click "Early Masking Countries"

Note the URL is https://its-airborne.org/early-masking-countries.html

The URL still works as https://its-airborne.org/early-masking-countries

The URL is better the second way. Could we have a _config option to allow the choice, please?

evanwill commented 3 years ago

@paul-hammant the navbar component pulls in the actual URL for the file when generating. Although leaving off the .html works on GitHub Pages, it isn't guaranteed to work on other servers, just depends on the configuration. I think what you are looking for is a "pretty url" style permalink--that way the pages will actually be generated with pretty URL rather than just leaving off the file extension--this avoids issues with different servers, etc.

The permalink is a Jekyll option, set in _config.yml . If you look at the bottom of your _config.yml you will find that in the template it looks like:

#######
# Defaults 
# to simplify front matter
# all files in the "pages" folder will be output at root of site
defaults:
  - scope:
      path: "pages"
    values:
      layout: page
      permalink: /:basename:output_ext

To get pretty urls you will need to do two things:

  1. On _config.yml, change permalink: /:basename:output_ext to permalink: /:basename/.
  2. On your "pages/index.md" you will need to add permalink: / (if you don't your home page will end up at /index/ which won't work as expected)

Thanks for link to your timeline site--looking good!

evanwill commented 3 years ago

Just to clarify what that does technically: the file "pages/example.md" with permalink: /:basename:output_ext will be output as the file /example.html; with permalink: /:basename/ it will be output as /example/index.html. The second option is a "pretty url" pattern. This allows users to access the page at example.com/example , example.com/example/ , or example.com/example/index.html on any server.

I will look at maybe changing the default template to pretty urls.