apache / apache-website-template

Apache Website Template
32 stars 36 forks source link

jekyll generates name.html instead of /name/index.html #12

Open adinancr opened 5 years ago

adinancr commented 5 years ago

In the past from files like download.md, a download/index.html was generated.

In my current version of jekyll install,
bundle exec jekyll serve (or build) generates .html files from .md files, for example downloads.html instead of downloads/index.html as before.

My version of ruby is ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu], bundler version 2.0.2, jekyll 2.4.0 (found using bundle exec jekyll -v) on Ubuntu 18.04.2

Any suggestions? Is there a configuration parameter I could change - maybe Jekyll versions have different defaults?

lresende commented 5 years ago

Here is the Jekyll version I have:

jekyll --version
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Ignoring ffi-1.9.14 because its extensions are not built.  Try: gem pristine ffi --version 1.9.14
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring nokogiri-1.8.4 because its extensions are not built.  Try: gem pristine nokogiri --version 1.8.4
Ignoring nokogiri-1.6.8.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.8.1
jekyll 3.8.6

When I serve the site with:

bundle exec jekyll serve

I do have the files as you were expecting and not as you are seeing

[lresende@lresende-2018 target]$ ls -la
total 24
drwxr-xr-x  11 lresende  staff   352B Jan  5  2019 .
drwxr-xr-x  22 lresende  staff   704B Jan  5  2019 ..
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 assets
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 community
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 community-members
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 css
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 download
-rw-r--r--   1 lresende  staff   2.4K Aug 19 09:53 feed.xml
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 history
-rw-r--r--   1 lresende  staff   6.5K Aug 19 09:53 index.html
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 news
(dev) [lresende@lresende-2018 target]$ ls download/
total 16
drwxr-xr-x   3 lresende  staff    96B Jan  5  2019 .
drwxr-xr-x  11 lresende  staff   352B Jan  5  2019 ..
-rw-r--r--   1 lresende  staff   7.6K Aug 19 09:53 index.html
lresende commented 5 years ago

I would suggest updating the version of Jekyll and see if this helps with the issue in hand.

aalkz commented 1 year ago

I had this problem just today. The issue for me was that my permalink instruction on each .md file looked like this:

layout: post
title: Lectura del día
permalink: /lectura/:year-:month-:day

And it was generating files in _site like this:

/lectura/2023-03-19.html
/lectura/2023-03-20.html

And so on, so while the URL worked locally when I used jekyll serve, on my server Apache showed a 'forbidden' error message when trying to access example.com/lectura/2023-19-20

The way I forced jekyll into creating the folder for each one with an index.html file inside was just adding a / at the end of the permalink setting:

permalink: /lectura/:year-:month-:day/

This way I now had _site generating like this:

2023-03-19/index.html
2023-03-20/index.html

And the problem was gone. I would still like to get rid of the extra / to make it the preferred canonical version for SEO reasons, but I think that would require messing with .htaccess (or the equivalent to the server platform being used).

I don't know if this is the way this should be solved. An explicit setting on jekyll's side would be nice.

I hope it helps!