Your sites Log in Sign up Menu

Question about how Blot works?

In the developer docs it says

  • Check if there is a template whose route matches the request’s path. Render the template if it matches.
  • Check if there is a file which matches the request’s path in your blog’s folder. Send the file as a response if it matches.

First I didn't really understand this (me being locked into another model of thinking) but if I've understood things correctly it means that when I link to a page, for example 'archive', it will use the archive template file to see what needs to be done. Questions:

  • What are the "standard" templates that blot expects to see? archives, entries, entry, error, feed, search, tagged??

  • If a template use partials then it becomes possible to call that partial and it will be rendered. At least this is what I see when I call "head.html" and "header.html" (using the Blog template). Have I understood things correctly?


a year ago, 1 replies   developers   how-blot-works   Improve this question

Yes, you've understood things correctly. Blot doesn't need to see anything except a package.json configuration file, for a template to be considered valid. However, by convention, most of Blot's templates come with some combination of:

  • entries.html, which is used to render the index pages on your site e.g. /, /page/1, /page/2, etc.
  • entry.html, which is used to render the permalink page for a post on your site, e.g. /your-post-here
  • archives.html, which is used to render the archives page, typically a 'zoomed-out' version of the index page
  • tagged.html, which is used to render the index pages for posts with a given tag, e.g. /tagged/apple, /tagged/pear, etc.

Other common pages can be seen in the source for the Blank template and they're generally self-explanatory but please don't hesitate to ask if you have any questions about them

Any template file can be embedded in any other template file using the partial template syntax, which looks something like this when you want to embed the file 'header.html':

{{> header}}

There are no strict rules about these either, but Blot's templates typically have headers and footers which are consistent in appearance so we use partial templates to render these

Answered a year ago · Improve this answer