Creating a button in Kirby

Hi,

Creating a button in Kirby… I just can’t seem to work it out.

What are the easiest ways?

a. What Blueprint field(s) is best practice so it’s easy for myself and/or clients.
b. How to set up the PHP.

Examples:

  1. The URL: https://getkirby.com/. The text: getkirby.com
  2. The URL: https://getkirby.com/. The text: Get Kirby

I’m probably going to kick myself but, I cant seem to figure it out and there’s not much info in the forum.

Thanks in advance!

There are multiple ways, and it depends on where the button is going to be used. Your button examply is not really a button but a link, styled as button.

  • in a textarea field: use a link kirbytag and style as button on the frontend if really necessary: (link: …) | Kirby CMS
  • in a blocks/layout field: create a custom button block: Blocks | Kirby CMS
  • a structure field with a single item with one field for text and on for the link can be use for a stand-alone button
  • The link field plugins provides another way for a stand-alone button: Link Field | Kirby CMS
  • If you want to link to a page, a pages field could be used to select the page to link to (url and text would come from the selected page)

Brilliant! This is really helpful! I think I’ll go with the Blocks for now but the Link Field plugin seems really interesting.

Thanks for your help.

Hi, I am also trying to implement a button on a page in Kirby. The goal is that the buttons leads via link to a hubspot form. What is the easiesrt way to do this?

The options are outlined above: Creating a button in Kirby - #2 by texnixe, so it depends where you want to have this button

Thanks. I want to place the within a page (blogpost). This button should lead to a Hubspot form which I would create in Hubspot. So is the first option the right one for this?

Depends on what you are using to create text content in your page and if the button should be place inside that text. Please post the corresponding blueprint if unsure.