picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 616 forks source link

Archetypes and Shortcodes equivalents in PicoCMS. #648

Closed notakoder closed 1 year ago

notakoder commented 1 year ago

Is there a PicoCMS equivalent of Hugo's Archetypes and Shortcodes? Or perhaps a workaround if there aren't any equivalents?

mayamcdougall commented 1 year ago

I've never used Hugo, so I'm just making some guesses based on skimming the documentation briefly. From what I can tell:

Hopefully I've got that right. Unfortunately, no, there's no equivalent in Pico.

Archetypes sound like they'd be completely out of scope for Pico, because Pico doesn't have a binary command that you run, and thus wouldn't really be able to "manage" these templates for you. The Pico workflow would simply be to have your markdown templates as plain files somewhere, and copy them as needed.

Shortcodes actually do sound like they could be useful, however, they'd be a lot of work to implement. I think this could potentially be done as a plugin if someone were dedicated enough. Markdown content is mostly just processed by Parsedown (which converts it to HTML). A plugin could probably hook into Pico and pre-process the content to evaluate these new snippets right before the content gets processed by Parsedown.

Again though, it'd be a really big, somewhat messy undertaking (especially when you're talking about shortcodes taking parameters and not just being static variables), so I think if Pico ever did get a feature like this, it would be from a user-created plugin rather than an official feature. 😔

(@PhrozenByte, you're welcome to chime in if you've got any thoughts on adding this kind of feature...)

Still, it's definitely possible to implement this in Pico, but I don't think anyone has so far.

(And I'm going to tell the part of my brain that says "I bet I could brute-force a solution to that in Twig! P=" to shut up now. 🤦🏻‍♀️ )

Sorry I don't have a better answer than that. 😅

notakoder commented 1 year ago

Thanks for the reply. It not just answers my question but explains the feature possibilities and workarounds too.

Also, a twig workaround isn't necessary at this point. So that part of your brain can relax as well. :smile: