-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Make page suffix configurable (currently fixed to .html) #2452
Comments
Inviting feedback from @bencodezen @billyyyyy3320 @kefranabg :) |
I am keen to see a solution for this and @dennisreimann's suggestion seems simple and elegant, would this change be accepted if a PR is made? |
I could provide a pull request – anyone from core interested in this? |
@dennisreimann Sorry for the very late reply. It sounds great to me. Also, IMO, the config should be a property of Markdown config. cc @shigma @meteorlxy (Plugin authors) |
@billyyyyy3320 Thanks for the feedback, I provided the PR #2674. |
Feature request
What problem does this feature solve?
Generating correct links when the clean-urls plugin is used.
Let's assume the plugin is used with the options
{ normalSuffix: '/', indexSuffix: '/' }
and a pageguide.md
.The plugin modifies the path of the resulting page, so that it gets exported as
guide/index.html
instead of the standardguide.html
.This solves only one part of the problem though, as the links generated by Vuepress are still
guide.html
. As the warning in the plugin README mentions, this isn't a problem as long as JavaScript is used because the router handles both cases. But following those links without JavaScript or opening them in a separate window/tab leads to the 404 page, because there is noguide.html
butguide/index.html
. We noticed this when adding a broken link checker to our project.As a solution to that, the proposed change gives the option to configure the links that get generated by Vuepress, so that users and plugins can hook into that. In parts, this request relates to #2420 and #2424.
What does the proposed API look like?
Extending the markdown link plugin with an option for the suffix, which is currently hardcoded to be
.html
.How should this be implemented in your opinion?
.html
toRouterLink
of the markdown link plugin to make use of the new option:Are you willing to work on this yourself?
Yes, if this is a wanted change I could take it on.
I verified that this works at least for the described case by monkey-patching the
link.js
file.There might be edge cases involved though, but the cases described in #2420 and #2424 seem like other good real-world examples.
The text was updated successfully, but these errors were encountered: