requarks / requarks/wiki

Bad url instead of language is prepended for internal links if on sidebar

Open
#958 1 comment 0 reactions 1 assignee View on GitHub

@NGPixel is already working on this.

Since Aug 13, 2019.

bug
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/index becomes example.com/poikilos/poikilos/index (bad URL)
  • poikilos becomes example.com/poikilos (bad URL)
  • /en/poikilos becomes example.com/en/poikilos (bad URL)
  • /poikilos/index becomes example.com/poikilos/index (good URL, but has no translation)
  • /en/poikilos/index becomes 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:

  1. 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).
  2. 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).
  3. Make a Navigation bar item with the same exact relative path: poikilos/index.
  • Type: Internal Link
  • Target: poikilos/index
  1. 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)
  2. 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
image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.