getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.65k stars 952 forks source link

Question: how to generate non-index.html html files? #2271

Open Jared-Sprague opened 1 year ago

Jared-Sprague commented 1 year ago

Hello!

Is there a way to generate files that are not named "index.html"? I want to generate a file at /includes/head.html instead zola generates a file at: /includes/head.html/index.html Is there a way to tell zola to generate a file at a specific path and name it something other than index.html?

Here is what is in my content/ directory:

content/
├── includes
│   └── head.md

And the markdown for head.md looks like this:

+++
title = '''Head'''
path = "/includes/head.html"
template = "includes/head.html"
[extra]
noindex="true"
+++

CONTENT

And the end result after the site has been generated in public/ looks like this:

includes
└── head.html
    └── index.html

I want it to look like this:

includes
└── head.html

Thanks!

mwcz commented 1 year ago

Related: #840

Jared-Sprague commented 1 year ago

NOTE: the use case for this is for an SSI include e.g.:

<!--#include virtual="/includes/head.html" -->

Which to me looks cleaner than:

<!--#include virtual="/includes/head/index.html" -->

Especially since this is never ment to be accessed directly in a browser, so the "clean" url concept does not apply here. In fact I would argue that in code it's actually cleaner to not use the index.html in the include tag.