File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ defmodule Tableau.PostExtension do
8
8
9
9
Frontmatter is compiled with `yaml_elixir` and all keys are converted to atoms.
10
10
11
- * `:id` - An Elixir module to be used when compiling the backing `Tableau.Page`. A leaking implementation detail that should be fixed eventually .
11
+ * `:id` - An Elixir module to be used when compiling the backing `Tableau.Page`. Optional .
12
12
* `:title` - The title of the post. Falls back to the first `<h1>` tag if present in the body.
13
13
* `:permalink` - The permalink of the post. `:title` will be replaced with the posts title and non alphanumeric characters removed. Optional.
14
14
* `:date` - A string representation of an Elixir `NaiveDateTime`, often presented as a `sigil_N`. This will be converted to your configured timezone.
@@ -90,9 +90,13 @@ defmodule Tableau.PostExtension do
90
90
91
91
posts =
92
92
for post <- apply ( Tableau.PostExtension.Posts , :posts , [ ] ) do
93
+ post_id =
94
+ post . id ||
95
+ post . title |> String . replace ( ~r/ [^[:alnum:]]+/ u , "_" ) |> Macro . camelize ( ) |> then ( & ( "Post." <> & 1 ) )
96
+
93
97
{ :module , _module , _binary , _term } =
94
98
Module . create (
95
- Module . concat ( [ post . id ] ) ,
99
+ Module . concat ( [ post_id ] ) ,
96
100
quote do
97
101
use Tableau.Page , unquote ( Macro . escape ( Keyword . new ( post ) ) )
98
102
You can’t perform that action at this time.
0 commit comments