PHPackages                             fabianmichael/kirby-links - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fabianmichael/kirby-links

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

fabianmichael/kirby-links
=========================

1.0.0-beta.16(3mo ago)0815↓33.3%1[1 issues](https://github.com/fabianmichael/kirby-links/issues)MITPHP

Since Jul 3Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/fabianmichael/kirby-links)[ Packagist](https://packagist.org/packages/fabianmichael/kirby-links)[ Docs](https://github.com/fabianmichael/kirby-links)[ RSS](/packages/fabianmichael-kirby-links/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (17)Used By (0)

Links plugin for Kirby CMS
==========================

[](#links-plugin-for-kirby-cms)

This plugin improves link handling within Kirby by providing an extensive toolkit for managing links in the panel and using them in your templates.

**What’s in the box?**

- The all-mighty `resolve_link()` helper function ingests almost anything and tries to turn it into a link.
- Panel blueprints for editing single links, link lists and a simple menu builder (using Blocks fields under the hood).
- Nice block previews for links in the panel
- The blueprints are extensible and can eeasily be used for fancier stuff such as a button list or link with icons

Installation
------------

[](#installation)

This version of the plugin requires PHP 8.4 and Kirby 4 or 5. Installations is currently only supported with composer:

$ composer require fabianmichael/kirby-links

How it works &amp; what is does
-------------------------------

[](#how-it-works--what-is-does)

Dealing with links is a very commmon task for CMS and Kirby is no exception. Kirby comes with a built-in link field, but that does not support custom link texts, opening in new tabs, the download attribute etc.

This plugin uses the blocks field for handling single or multiple links, navigation lists and submenus. Each block has a set of fields for settings the details of each link. This approach still allows us to encapusle all link data in a single object, while making the plugin extensible, e.g. you can extend the blueprints for handling the style or tracking parameters of links.

Getting started
---------------

[](#getting-started)

### Single link

[](#single-link)

This example includes a link to the article author:

```
# site/blueprints/pages/article.yml

title: Article

fields:
  […]
  author:
    extends: fields/link
    title: Author link
```

```
# site/templates/article.php

  Author:

```

List of links
-------------

[](#list-of-links)

```
# site/blueprints/pages/article.yml

title: Article

fields:
  […]
  authors:
    extends: fields/links
    title: Author links
```

```
# site/templates/article.php

```

### Navigation with submenus

[](#navigation-with-submenus)

… alrady implemented, docs coming soon

Advanced usage
--------------

[](#advanced-usage)

### Extending the blueprints

[](#extending-the-blueprints)

There are occasions, when you need more fields for your links, that what is included by default. A common example would be a list of buttons, where you can chose between primary and secondary button styles. The blueprints can easily be extended with additional fields.

```
# site/blueprints/blocks/buttons.yml

name: Buttons
icon: bolt
fields:
  buttons:
    extends: fields/links
    fieldsets:
      button:
        extends: blocks/link
        fields:
          style:
            type: toggles
            label: Style
            default: primary
            options:
              primary: Primary
              secondary: Secondary
            required: true
```

```
# site/snippets/blocks/buttons.php
