I’d like to be able to define a custom css class to certain links in a basic Writer-field.
The use case is that most links are basic underlined links, but the client would like to be able to define the link as a “button” style. I basically want to add a .button class to the a-tag in those cases.
How would one go about it? Using Kirby 4 by the way.
I’ve looked a bit at custom nodes and marks, but haven’t really grasped it, and feel unsure if I’m overcomplicating something that maybe could be solved cleaner.
It could also be a great option just to “extend” the link-tag to have another toggle like the “open in new window” that would be “show as a button”. But again, unsure how to get there.
Any tips on how to go about this would be appreciated
I remember that there used to be a plugin or kirby link-popup with a class input field. I created this feature-request for it: https://kirby.nolt.io/604
In the meantime I’ll probably work with a button block:
button:
icon: url
wysiwyg: true
preview: fields
fields:
link:
type: link
label:
type: text
I actually ended up conditionally styling links within the last paragraph in a writer-section as buttons, because the use case was exactly like your screenshot – finishing off a section with a single button.
Feels kind of weird, but worked in this particular use case for a very simple site.