feat: default in subdirectory option #322
Open
+302
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses problem of broken link/image path due to moving default language to top level. (
/en/to/)This PR implementation introduces
force_default_in_subdirectoryconfig option, which let user to decide moving default language to top level or subdirectory with backward compatibility.However, this change introduces new configuration option, so I would like to discuss best configuration option.
Other alternative implementation option:
Alternative Configuration 1: "Move files to the path if
linkconfig is set to language"Currently, link generated for default language is broken (404 error) if link is set to path other than
/(i.e./en/) since file is moved to top level.Allowing moving path to
linkis more intuitive but may introduce change to existing user usinglinkoption configuration.Consideration
Handling contents without locale info
This PR implementation have discrepancy between folder configuration and suffix configuration.
For folder configuration, files not under lang folder does not belong to specific language and path is not changed.
But in suffix configuration, file without suffix is currently treated as default language, so files is moved too.
Current design of plugin and option introduced by this PR may create discrepancy between folder and suffix configuration.
Top level path redirection
I am developing my own site with this branch with index.html which redirects to default language page, but this can possibly done in plugin.
Related Issue
#306