# Buttons and links

**URL:** <https://forum.getkirby.com/t/buttons-and-links/9861>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 2, 2018, 9:52am UTC](https://forum.getkirby.com/t/buttons-and-links/9861 "2018-03-02T09:52:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![helprin](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@helprin](https://forum.getkirby.com/u/helprin)\
**Post date:** [March 2, 2018, 9:52am UTC](https://forum.getkirby.com/t/buttons-and-links/9861/1 "2018-03-02T09:52:41Z")

</div>

I have troubles with adding links via panel. I use this approach to create buttons with url link and link text (see below) which I can edit via panel, but the problem is that even though I add different url link via panel it still shows the path to the current (active) page and it doesn’t redirect to proper page after clicking on button. Could someone explain me how it should be done in a correct way?

` <a href="<?= $page->url()?>" class="button" role="button"><?= $page->linktext()->html() ?></a>`

Thanks! Sorry if it’s a stupid question, but I still struggle a bit with PHP and Kirby.

---

<div class="post-metadata">

**Author:** ![lukaskleinschmidt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukaskleinschmidt/32/13388_2.png) [@lukaskleinschmidt](https://forum.getkirby.com/u/lukaskleinschmidt)\
**Post date:** [March 2, 2018, 9:58am UTC](https://forum.getkirby.com/t/buttons-and-links/9861/2 "2018-03-02T09:58:11Z")

</div>

Is your field for the page you want the link to called `url`? If so `url` is a page method that will always get the link of the page you call it on.

You would have two options:

**1.** Rename your field from `url` to `link` or something similar and use it like this:

```php
<a href="<?= $page->link()?>" class="button" role="button"><?= $page->linktext()->html() ?></a>

```

**2.** Get the content field via `$page->content()->url()`.

```php
<a href="<?= $page->content->url()?>" class="button" role="button"><?= $page->linktext()->html() ?></a>

```

---

<div class="post-metadata">

**Author:** ![helprin](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@helprin](https://forum.getkirby.com/u/helprin)\
**Post date:** [March 2, 2018, 10:24am UTC](https://forum.getkirby.com/t/buttons-and-links/9861/4 "2018-03-02T10:24:54Z")

</div>

Thanks for help! The first solution was what I was looking for.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:29pm UTC](https://forum.getkirby.com/t/buttons-and-links/9861/5 "2025-02-06T17:29:56Z")

</div>

Archived on February 6, 2025, 5:29pm UTC


