Coder Social home page Coder Social logo

Comments (8)

edwardhorsford avatar edwardhorsford commented on July 17, 2024 1

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.

kleinfreund avatar kleinfreund commented on July 17, 2024 1

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.

zachleat avatar zachleat commented on July 17, 2024

Related: #22

from 11ty-website.

kleinfreund avatar kleinfreund commented on July 17, 2024

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.

jevets avatar jevets commented on July 17, 2024

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.

jevets avatar jevets commented on July 17, 2024

@kleinfreund I'm totally good w/ that, it's been working for me just fine.

from 11ty-website.

Ryuno-Ki avatar Ryuno-Ki commented on July 17, 2024

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.

zachleat avatar zachleat commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.