guilty/craft-slugify

Adds slugify twig extensions to your craft install.

Maintainers

Package info

github.com/guilty-as/craft-slugify

Type:craft-plugin

pkg:composer/guilty/craft-slugify

Statistics

Installs: 19 191

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

1.0.1 2018-11-05 15:22 UTC

This package is auto-updated.

Last update: 2026-03-07 04:26:51 UTC


README

Craft Slugify simply adds the Twig filter "slugify" to your Craft install, the cocur/slugify package is used for the actual slug generation.

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:
cd /path/to/project
  1. Then tell Composer to load the plugin:
composer require guilty/craft-slugify
  1. In the Control Panel, go to Settings → Plugins and click the “Install” button for Craft Slugify.

Using Craft Slugify

{% set posts = craft.entries.section("posts").all() %}

<h1>Table of contents</h1>
<ul>
    {% for post in posts %}
        <li><a href="#{{ post.title | slugify }}"> {{ post.title }}</a></li>
    {% endfor %}
</ul>

<hr>

{% for post in posts %}
    <article id="{{ post.title | slugify }}">
        <h2>{{ post.title }}</h2>
        <div>{{ post.bodyContent }}</div>
    </article>
{% endfor %}

Brought to you by Guilty AS