0
votes

Since I list all my posts in one page called fotos.html I don't need the individual posts to appear as HTML files in the _site output directory. How can I tell Jekyll to not output the .md posts in the _posts directory as individual HTML files?

[Screenshot of the Jekyll output directory

E.g. The contents of Firmwochenende.html are present in fotos.html with properly formatted title and date. Firmwochenende.html includes only photos and nothing else, which is not useful at all.

I build using build exec jekyll serve and host on Github Pages: https://github.com/junge-pfarre/junge-pfarre.github.io

These are the relevant parts of _config.yml:

defaults:
  - scope:
      path: ""
    values:
      layout: "default"
  - scope:
      path: "assets/flyer"
    values:
      flyer: true

markdown: kramdown

permalink: :title

A simple post has these contents:

---
title: Jugendandacht Gründonnerstag
---
![Altar der Josefskapelle in der Pfarrkirche Baden St. Stephan][1]

[1]: {{ site.baseurl }}{% link /assets/fotos/Jugendandacht2018.jpg %}
1
exclude: [_posts] in _config.yml doesn't work, btw.Stefan_EOX
You can create a data file with a list of your photos with titles, then display them using a special template that loads your data file at fotos.html.marcanuy
Will I still be able to use pagination then? Or would I have to come up with my own pagination solution then?Stefan_EOX

1 Answers

1
votes

You'll need to use a custom collection rather than the default as the _posts collection is, by design, always going to output individual files. If you create a new collection, you can specify output: false for that collection in your config file while still being able to iterate through it and display the content. From the Jekyll documentation:

# Config file

collections:
  your_collection_name:
    output: false

However, I saw that you mentioned pagination in the comments. I don't believe GitHub currently supports a gem that has pagination functionality for collections other than _posts (like jekyll-paginate-v2, though they're in talks on merging this in eventually). In the meantime, it looks like there are some solutions out there to help with this limitation.