Bad url instead of language is prepended for internal links if on sidebar
@NGPixel is already working on this.
Since Aug 13, 2019.
- Dominant language
- Vue
- Stars
- 28.9k
- Forks
- 3.3k
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Description
Describe the bug
2.0 beta renders internal links (poikilos/index) incorrectly, so leading slash must be added, but that prevents translation. The Navigation behavior link behavior seems to differ from the in-page link behavior. Only the Navigation behavior seems incorrect, though the in-page link behavior, not documented, is discovered by trial and error in the "Links on index page of a category" section further down.
Navigation bar behavior
(using various targets, where example.com is the correct website, but subdirectory is sometimes incorrect)
poikilos/indexbecomes example.com/poikilos/poikilos/index (bad URL)poikilosbecomes example.com/poikilos (bad URL)/en/poikilosbecomes example.com/en/poikilos (bad URL)/poikilos/indexbecomes example.com/poikilos/index (good URL, but has no translation)/en/poikilos/indexbecomes example.com/en/poikilos/index (good URL, but translation must be hardcoded in markdown)
Links on index page of a category
(Links to subtopics from within a topic)
These behaviors all seem technically as expected--the URL must be relative. Point "e" below appears to be the correct syntax, though it isn't documented yet. One remaining issue may be that sub-sub topics are allowed (see point "d"), and I don't know whether that is by design.
When page has a "bad URL" below, the page also says "This page does not exist yet," and offers the "Create Page" button which could cause problems (duplicates in different categories--and/or possibly in different languages but I don't know) if clicked in these specific cases.
Tested on pages in markdown format:
a. en/poikilos/Subtopic becomes example.com/en/poikilos/en/poikilos/Subtopic (bad URL, but probably expected)
b. /en/poikilos/Subtopic becomes example.com/en/poikilos/Subtopic (good URL, but translation must be hardcoded in markdown)
c. /poikilos/Subtopic becomes example.com/poikilos/Subtopic (good URL, but has no translation)
d. poikilos/Subtopic becomes example.com/en/poikilos/poikilos/Subtopic (bad URL: though it does prepend translation, it offers to make a Subtopic page in a sub-sub category called poikilos/poikilos--are sub-sub categories even allowed? Maybe they shouldn't be, and the Create page button shouldn't be offered, and a "Would you like to create it?" should not display)
e. Subtopic becomes example.com/en/poikilos/Subtopic (good URL, and translated, so I suppose this is the "right" way, but it differs from 1.x documentation which says to start with a leading slash: [Internal Link Title](/path/to/page))
e. /Subtopic becomes example.com/Subtopic (bad URL: not categorized, not translated)
Link to subtopic from outside:
poikilos/Subtopic becomes example.com/poikilos/Subtopic (good URL, but not translated)
To Reproduce
Steps to reproduce the behavior:
- Add a section called poikilos (results in a page with poikilos/index as the self-described "Path"; see screenshot of page in Pages section of admin area).
- Add a page called Subtopic in poikilos (results in a page with poikilos/Subtopic as the self-described "Path" in the Pages section of the admin area).
- Make a Navigation bar item with the same exact relative path:
poikilos/index.
- Type: Internal Link
- Target: poikilos/index
- Make the following URL on another uncategorized page such as Home:
(poikilos/Subtopic)[poikilos/Subtopic](reproduces behavior described under "Link to subtopic from outside" above) - Make the following URLs inside of the index page (MUST be on that page, so relative link works):
(this step is optional, since the behavior in the "Links on index page of a category" section above seems correct)
- [en/poikilos/Subtopic](en/poikilos/Subtopic)
- [/en/poikilos/Subtopic](/en/poikilos/Subtopic)
- [/poikilos/Subtopic](/poikilos/Subtopic)
- [poikilos/Subtopic](poikilos/Subtopic)
- [Subtopic](Subtopic)
- [/Subtopic](/Subtopic)
Expected behavior
When using a nav target such as poikilos/index, the URL should be translated (to example.com/en/poikilos/index (to make the self-described "Path" usable, such as in the screenshot).
Screenshots

Host Info (please complete the following information):
- OS: unknown
- Wiki.js version: 2.0.0-beta.241
- Database engine: SQLite
Additional context
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.