Proposal: Map Bard content to (typography) components #398
carstenjaksch
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
Hey, thanks for sharing. It's an interesting approach, but not something I'm look for. To clarify, how I use all this is broadly:
So they're different things and in practice always almost differently styled. |
Beta Was this translation helpful? Give feedback.
1 reply
-
@carstenjaksch I really like that approach. It's something I tinkered with in the past too but never managed to go beyond the tinkering because, well "you can overwrite prose styles even when I hate the approach". I probably will give that a shot in the next project. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is my first time with Peak, so I played around a bit and stumbled upon the
page_builder/_article.antlers.html
partial.I like the modular approach with typography partials and was confused that the Bard content doesn't render with these partials – instead the HTML is left as is. That defeats the purpose of global typography partials for me, because there are elements on the page that aren't using them.
So I went on the journey (as a new Statamic user) to map the Bard content to corresponding typography partials. Here is my very early prototype:
There is a new tag named "BardPartial" that takes the Bard content (currently with the
raw
modifier, because I don't know how to get that from the variable withoutraw
in PHP), loops through that and renders a component for each Bard block.Special is the
components/_text.antlers.thml
partial – for that I needed to "group" junks of text and render that again with this partial.Now all Bard blocks use the typography partials for global layout/styling, which is kinda cool I think.
Code:
As said, this code is a very early prototype and could be enhanced by an experienced Statamic developer.
What do you think about my idea?
Beta Was this translation helpful? Give feedback.
All reactions