Comments (8)
Just for clarity around my case - my confusion was around the word 'includes', not the word 'templates'. Personally, I view templates as the clearer word.
At my previous work, we tended to default to 'views' for the templates folder. This may be because we were mostly rails based.
from 11ty-website.
I would say one includes directory is fine. This is already configurable. Further separation of concerns can be accomplished by creating directories inside the includes directory with more specific names.
from 11ty-website.
Related: #22
from 11ty-website.
A template serves as a pattern for creating a thing. A similar term is scaffold. For example, layout templates are patterns (or scaffolds) for a document. As such, they encompass the document’s structure but not its content. You can exchange "document" with "piece of content" to make it more general. Thus, a partial template (something you would include somewhere) is a pattern for a piece of content.
Looking at programming languages in general, a template is always something that needs to be filled with something more specific, some sort of content. For example, template literals:
const userTemplate = `${userName} (@${userHandle})`;
Bottom line regarding the specifics of a static site generator: Not all templates are included (e.g. layout templates) and not all includes are templates (e.g. a SVG or CSS file). Some static site generators solve this by separating layouts and includes. Both can contain templates, but only the ones belonging to the includes category are meant to be included.
(I find this whole topic highly interesting. Naming things, right?)
from 11ty-website.
I agree with @kleinfreund, template
is just something to be reused, is usually sent data.
I do use _includes
for files other than HTML-generating templates.
I think what could be more useful is if we could configure _includes
folders, maybe allow 11ty to read from multiple folders knowing it won't output those files. This way users could easily set up a views
tree or whatever other structure they'd like.
from 11ty-website.
@kleinfreund I'm totally good w/ that, it's been working for me just fine.
from 11ty-website.
A template is a piece of markup with placeholders which accepts a context object to generate the final markup.
A partial is a reusable chunk of markup. Think of it as a parametrised template.
A view uses the context object to actually execute the template rendering.
from 11ty-website.
Thanks for your feedback here everyone! I’m going to close this for now—if anyone has actionable steps they’d like to recommend to improve the docs from this, please file them!
from 11ty-website.
Related Issues (20)
- Author pages are not being displayed HOT 5
- Cannot read properties of undefined when running locally HOT 1
- Sparkline demo isn't good in dark mode HOT 2
- Blog post date cut off horizontally HOT 2
- Error appears on author pages HOT 1
- Example of custom permalink in frontmatterdata broken on supplied data documentation HOT 2
- Example of changing file extensions gloablly broken in supplied data documentation HOT 4
- Broken code blocks on 11ty.dev HOT 1
- Web starter screenshot and scores inconsistent HOT 1
- Make "Starter Projects" page useful/trustworthy
- Website not reachable via IPv6
- Add prettier config HOT 4
- Please delete the "toc-extract" plugin from the list. HOT 2
- Remove 11ty.webc.fun from the WebC docs HOT 5
- Some images aren't loading on the 11ty.dev website HOT 2
- Blog post about eleventy folder structure HOT 2
- Format all files HOT 2
- `bannerlinks.js` should be updated HOT 2
- Configuration Docs Do Not Reference `addTemplateFormats` API HOT 1
- I built a site with Eleventy! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 11ty-website.