How to get filenames without dates

Hi, I would like to remove the dates in my filenames.

It looks like I’m forced to use collections (Is there a way to do it with posts?). How can I get jekyll to render a collection other than posts on the index page?

Is it possible to automatically set the slug from the folder that the article is in? If my article is in _articles/my-article-title/index.md, I would like the slug to be my-article-title.

date in filename is a convention you have to stick to with Jekyll.

The same way you would with posts, except you loop over your collection instead.

{% for article in site.articles %}
  <h2>{{ article.title }}</h2>
  ...
{% endfor %}

see https://jekyllrb.com/docs/collections/#output

You can try:

collections:
  articles:
    output: true
    permalink: /:collection/:path

see https://jekyllrb.com/docs/permalinks/#collections

1 Like

Where do I put this code? I didn’t need to code anything for it to show my posts.

the default code is looping over post, you would probably swap that code with his example.

That is either in the main index file or maybe a layout or include called by it, you should poke around and try to reverse engineer it and it should make some sense.

I figured out how to do it. I needed to create the file _layouts/home.html and copy the content from here. Then I needed to change “posts” to “articles” in line 15.