Templates/Re-usable Blocks #1253
Replies: 8 comments 2 replies
|
You don't mean page templates, right? Are you thinking more of transclusions — where you reference a shared block from another page and it gets rendered inline wherever you use it? Something like [[block:contact-info]] that pulls in the content automatically? |
|
That's a great point and honestly the stronger use case. Single source of truth: define something once, include it everywhere. If it changes, you update it in one place and it's reflected across the whole wiki automatically. I've seen the same pattern with IP addresses, API endpoints, version numbers. |
|
Well, I am talking about both. Whole page templates for commonly created pages. In the case of the computer repair shop to use internally, a repair method page. It would share things like Symptoms, Troubleshooting steps, Repair steps, etc. After creating a new page with the template, the specific details would be entered. But more, I was talking about being able to create & customize small blacks that could be injected into new or existing pages with a GUI button or a typed variable e.g. {{custom-block-1}} The example given was the contact info block. I did not have in mind the idea of transclusions but I guess that is pretty much what I was trying to describe. Your code [[block:contact-info]] is a good example. I didn't necessarily mean it to pull from another page. Although, that's a cool idea. Currently, I have a custom callout with the contact info and I am just copying that and pasting it into new pages. |
|
I'm currently not totally sure, how it should be! I will create a proposal. |
|
😄 Not sure as in how to code? Unfortunately, I cannot help with that. I wish I could. I would. Or, do you mean you don't know what the functional methodology should be? I could at least be a sounding board for that. Maybe one of the other contributors could put in their two cents as well. |
|
Yeah, a centralized snippets store makes great sense. At least for small(ish) re-usable content blocks. Now, if whole page templates are an option, this may need different handling, IDK. In Bookstack, for instance, you create a page and add the Template Tag to it. This makes it available to insert into or replace a blank page with the contents of the Template tagged page. These Template pages are typically saved in their own "Book". Admins can control visibility of the Template Book based on user roles. |
|
I had seen other discussions here about system placeholders. The one example (which I upvote) is a placeholder for the default list (TOC) of pages under a section. When you manually edit that page the TOC is gone. If a user wanted to keep that information they would have to manually add and update it. Having a placeholder variable to get this dynamic function back would be most convenient. Could your snippets concept double to cover this? |
|
for the sections it would be nice to have a template that is used when creating a new page in that section |
Uh oh!
There was an error while loading. Please reload this page.
Several other Wikis have the ability to make custom page Templates. I'm sure you've thought of this already. Bookstack does it by having the user design the page then assign a "template" tag to it. This makes it available to re-use any time. It is quite handy.
Additionally, and my use case is probably very narrow again, I think it would be interesting to be able to make re-usable blocks. For example:
I work at a mom & pop computer repair shop. Most of our customers are senior citizens who do not understand computer basics. I am setting up LeafWiki to be a public facing repository of How To tutorials and FAQs. We could use this in-store as well; print them the tutorial they need and send them on their way rather than explain it and they forget or don't understand. But I digress.
It would be very convenient to have customizable, re-usable blocks to inject into every printable tutorial. This block, for instance, could have the store name, address, phone number, store hours, etc. It isn't the most difficult thing to copy and paste it from one page to another but a GUI button or quickly typed placeholder would speed things up.
More ideally, it would be neat to be able to have the option for the block only to show up on printed or saved-as-PDF pages. Maybe that's too much. Probably need a custom stylesheet at least for that.
All reactions