dmulholl / ark

A static website generator for people who enjoy the simpler things in life.
https://www.dmulholl.com/docs/ark/master/
BSD Zero Clause License
120 stars 7 forks source link

Q: include files in themes? #4

Closed gvwilson closed 2 years ago

gvwilson commented 2 years ago

Is there a way to put include files in themes, e.g., lib/whatever/inc? I have several snippets that are shared between templates, and including them in the template directory rather that in the root inc directory seems more portable. thx - Greg

dmulholl commented 2 years ago

Hi Greg. I'm not sure I understand the use case -- could you give me an example?

gvwilson commented 2 years ago

I am trying to build a theme that I can use across several sites. I can do what I want with template inheritance, but it feels very contrived: it would be a lot easier to have:

<!DOCTYPE html lang="en">
<html>
  <head>
    {% include mathjax %}
    {% include plausible %}
    ...template-specific stuff...
  </head>
  ...

in several places - putting those files in the inc directory of the project rather than in lib/whatever/inc feels leaky.

dmulholl commented 2 years ago

You should be able to put files like that directly into the theme's templates directory -- that's where Jinja and Ibis are configured to look for files included using the {% include %} tag.

gvwilson commented 2 years ago

Thanks, that seems to work.

dmulholl commented 2 years ago

Excellent. I've updated the documentation to hopefully make that clearer for future users.