Extensible / customizable quarto website templates (e.g. permit customize EJS templates) #6552
Replies: 6 comments 5 replies
-
@cboettig I'm not well placed to speculate on how possible this is for other parts of the website, but it is already a thing for listings, so that's something! Being able to make your own listing templates really lets Quarto compete with other blogging engines IMO. The website format is already pretty configurable outside that, between HTML include options, custom themes and other website and HTML options, as well as either just directly writing Markdown (or HTML, using a |
Beta Was this translation helpful? Give feedback.
-
@jimjam-slam yup, I'm aware of listings and the html options, though I don't believe the html options let you replace the website template whole-sale. It's not clear to me how it all works either, but I believe the EJS website templates are applied after the html pandoc templates are applied, and other than listings I don't think they can be customized. For instance, I'm particularly interested in being able to customize the behavior of navigation menus. nav-related templating makes up a significant bit of those templates, and is unique to website format, unlike elements in the (generally single-page-oriented) html format. I love all the built-in support for quarto navigation menus -- top bar, side bar, footer, right-hand menu etc, it's rich and lovely, but it's hard to tweak, e.g. what if I merely want to add an additional Like you say, everywhere else quarto is really extensible and theme-able. but in most static site generators we also have control over things like how nav links from the quarto.yml get mapped to nav menus on the page. And it's already all there in the 20-odd website EJS templates (nearly all nav-related TBH), but modifying those templates in small ways is the one part that seems out of reach. (we can hack a bit with css or js but it's difficult without being able to add any custom classes to the html elements). |
Beta Was this translation helpful? Give feedback.
-
I found that I can pass a custom template. For example on the about page I can do (at least as of v1.4.520):
however, I can't add custom properties to the page. I can't do:
This would be a nice feature that most static site generators have. |
Beta Was this translation helpful? Give feedback.
-
My org is working to improve the accesibility of our workshops, which are rendered via quarto. We got a comment during a review that says it's confusing that there are three Landmarks on the page all called "navigation" (see picture). For reference these are the sidebar, table of contents, and "page-navigation" (prev/next buttons in the footer). We'd like to be able to customize these |
Beta Was this translation helpful? Give feedback.
-
@mcanouli I disagree that my comment is off topic. I want to contribute to discussion of the feature request that users be able to customize the EJS templates, or to override the defaults with customized templates. |
Beta Was this translation helpful? Give feedback.
-
Even if our specific case is considered a "now" issue, it is still relevant to this general discussion of customizing EJS templates, yes? |
Beta Was this translation helpful? Give feedback.
-
Description
Quarto's website type is obviously an immensely popular aspect of the platform, but unlike other elements of quarto or other static site generators where users can customize layout templates, Quarto's website features are mostly hardwired in Embedded Javascript Template (EJS) files.
It would be very nice if users could swap out some of these existing templates for comparable user-supplied alternatives. Quarto already allows users to swap out the pandoc html.template in this way, simply by providing a path in the _quarto.yml metadata:
I wonder if it would be possible to simply provide a similar
template-partials:
field on thewebsite
block of the yaml that would behave similarly, allowing users to plug in, e.g. a custom nav-before-body.ejs in place of the one baked into the CLI? Maybe something like:While customizing the EJS templates would still be a somewhat advanced feature, (users would be responsible for understanding EJS, which after all seems to be a very nice and well documented templating system), I think this would at least open the door to customizing these design elements and maybe offering community-contributed extensions. At the moment, this whole aspect of quarto is a bit walled off from community extensions.
I realize the EJS template partials weren't initially introduced with the idea that users would customize them, and that there's an argument to be made for a more fully-flushed out user interface for web templating. That's obviously a heavy lift, but meanwhile I'm hoping that just changing the path of these templates from the hardwired location to a user-supplied path, matching the existing pandoc template customization method already available, is not impossible?
Beta Was this translation helpful? Give feedback.
All reactions