Closed gvwilson closed 2 years ago
Hi Greg. Ivy does indeed have a very-lightly documented option for generating directory-style URLs. If you add
extension = "/"
to your config.py
file, that should do the trick.
Thank you - that's worked. On a similar note, is there a way to prevent generation of an index.html
file for a node entirely? For example, if I have:
src
|-- advice
| |-- findability.html
| `-- safety.html
|-- bibliography.html
|-- index.html
`-- project.html
and I don't want either advice.html
or advice/index.html
in the output, can I achieve that? If I don't have src/advice/index.html
, I get the error message:
Error: Ivy cannot locate a template file for the node: '@root/advice//'.
There's a build_node
filter here that you can use as a switch to decide if a node should be written to disk.
You could write a little extension that checks the node's metadata for some kind of disable flag, e.g.
@ivy.filters.register('build_node')
def build_filter(enable_build: bool, node: Node):
if node.get('disable'):
return False
return True
I have no idea where the template error is coming from though, Ivy should be perfectly happy with a node directory with no index file inside it.
I've actually gone ahead and added support for a disable
flag directly to Ivy in version 6.1.0 as I think it's a generally useful feature.
thanks - I'll see if I can figure out why not having an index.whatever
file in a directory is causing conniptions.
Definitely let me know if you can track that issue down any further!
I think we figured this one out :)
The template error was happening because Ivy always looks in the last resort for a template file called node.*
. Your theme didn't have a template with this name.
I have:
I would like to produce:
so that
/a/
and/b/
will be valid URLs. Right now, Ivy wants to generate:Is there a way to force the desired behavior (so that old URLs won't break)?