You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/tableau/extensions/tag_extension.ex
+33-4Lines changed: 33 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,29 @@ defmodule Tableau.TagExtension do
6
6
7
7
The `@page` assign passed to the `layout` provided in the configuration is described by `t:page/0`.
8
8
9
+
Unless a tag has a `slug` defined in the plugin `tags` map, tag names will be converted to slugs using `Slug.slugify/2` with options provided in Tableau configuration. These slugs will be used to build the permalink.
10
+
9
11
## Configuration
10
12
11
13
- `:enabled` - boolean - Extension is active or not.
12
14
* `:layout` - module - The `Tableau.Layout` implementation to use.
13
15
* `:permalink` - string - The permalink prefix to use for the tag page, will be joined with the tag name.
16
+
* `:tags` - map - A map of tag display values to slug options. Supported options:
17
+
* `:slug` - string - The slug to use for the displayed tag
18
+
19
+
20
+
### Configuring Manual Tag Slugs
21
+
22
+
```elixir
23
+
config :tableau, Tableau.TagExtension,
24
+
enabled: true,
25
+
tags: %{
26
+
"C++" => [slug: "c-plus-plus"]
27
+
}
28
+
```
29
+
30
+
With this configuration, the tag `C++` will be have a permalink slug of `c-plus-plus`,
31
+
`Eixir` will be `elixir`, and `Bun.sh` will be `bun-sh`.
14
32
15
33
16
34
## Layout and Page
@@ -79,6 +97,8 @@ defmodule Tableau.TagExtension do
79
97
80
98
importSchematic
81
99
100
+
aliasTableau.Extension.Common
101
+
82
102
@typepage::%{
83
103
title: String.t(),
84
104
tag: String.t(),
@@ -89,7 +109,8 @@ defmodule Tableau.TagExtension do
89
109
@typetag::%{
90
110
title: String.t(),
91
111
tag: String.t(),
92
-
permalink: String.t()
112
+
permalink: String.t(),
113
+
slug: String.t()
93
114
}
94
115
95
116
@typetags::%{
@@ -102,6 +123,7 @@ defmodule Tableau.TagExtension do
0 commit comments