How to add file extension in url #65
Replies: 2 comments 1 reply
-
Here I bring you a solution. There are a few other ways to achieve what you need. Please tell me if it works for you. 1- Go to this file https://github.com/onwidget/astrowind/blob/main/src/utils/posts.js#L3 and replace: Before: const ID = file.split('/').pop().split('.').shift(); After: const ID = file.split('/').pop(); 2- Go to this file https://github.com/onwidget/astrowind/blob/main/src/utils/permalinks.js#L21 and replace: Before: export const cleanSlug = (text) => slugify(trimSlash(text)); After: export const cleanSlug = (text) => slugify(trimSlash(text), { custom: ['.'] }) |
Beta Was this translation helpful? Give feedback.
-
You know @Montekkundan, with your question I've been thinking: "what if we add a settings to Ex: export const BLOG = {
// (..)
post: {
disabled: false,
pathname: '', // empty for /some-post, value for /pathname/some-post
slugPattern: "%post_id%.md", // NEW PROPOSED SETTING
},
// (...)
}; Some of the frontmatter variables could be available as variables, example: %title% (with slugification), %category% (first if it is a list), %author% (first author) and some others generated as %year%, %monthnum%, %day%, %hour%, %minute%, %second%. All very similar to what Wordpress brings to configure the permalinks The default slug pattern would be %post_id% It's just an idea, we have to analyze it better so as not to complicate the template too much, what do you think? |
Beta Was this translation helpful? Give feedback.
-
I was wondering how can i make the website url look like this:
www.website.com/test.md
orwww.website.com/test.mdx
instead of
www.website.com/test
Beta Was this translation helpful? Give feedback.
All reactions