-
-
Notifications
You must be signed in to change notification settings - Fork 12
Improve posts extension with slugs, filename as default slug, and config-based default for layout #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the contribution! Overall this looks good, and I am on board with the direction, but I have a couple of tweaks in mind.
Nice 😎
What do you think about making the config key You could even make it capable of using any frontmatter key, but we cant punt that to another patch.
😎 , but Also, add some docs for the possible config, and noting which items will be overridden by frontmatter keys |
The config-backed permalink doesn't actually support |
Ahh, sorry. What I meant with my feedback was that you'd retrieve the permalink from the config, then maybe override from the frontmatter, then replace the template variables. |
Actually, now that I think about it, I think it might be better to not have a default value for the permalink, and only fallback to the filename. So # _posts/articles/my-post.md
id: Foo would turn into config :tableau, Tablea.PostExtension, permalink: "/posts/:title" # _posts/articles/my-post.md
id: Foo
title: "how to to a post" would turn into and config :tableau, Tablea.PostExtension, permalink: "/posts/:title" # _posts/articles/my-post.md
id: Foo
title: "how to to a post"
permalink: "/tips-and-tricks/:title would turn into I think this is simpler because by default, the logic is not
and becomes
and i think in a subsequent PR, we can introduce replacing the template variables with any arbitrary frontmatter keys, which would accomplish the goal of having a |
Thanks again for the contribution and with being receptive to feedback! |
Removed the slugs, and went with:
Doesn't work for the |
oh, yes i see what you mean now. Nice, this is awesome, thanks! |
I'm letting CI run now, will merge when it passes |
Looks like i had an errant |
Changes up a bit of logic in the posts extension to support very thin frontmatters, aiming for some defaults common to other SSGs - If permalink is supplied, permalink is where the "post" is generated. No questions asked - If a slug is supplied, a config value of `path` is read. Default is `posts/:slug`. Post is placed at this path - If no value for permalink or slug is provided, filename, stripped of its extension and path components, is used, with the configured default path
When this gets merged in I'll take a crack at the frontmatter term replacer. |
merged! |
Changes up a bit of logic in the posts extension to support very thin frontmatters, aiming for some defaults common to other SSGs
path
is read. Default isposts/:slug
. Post is placed at this pathThis lets you write posts like this:
And have it show up at a normal default spot in your routing tree.