Opened 5 years ago
Last modified 5 years ago
#13755 new defect
BackLinksMacro lists pages which do not have backlinks
Reported by: | Florian Berger | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | BackLinksMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.2 |
Description
The BackLinksMacro is supposed to "show you which wiki pages refer to the current page", .i.e. link to the current page.
However, the macro also lists pages that do not actually link to the current page.
Expected behaviour
A page linking to [[swallow]]
should be listed in the backlinks of swallow
. However, a page merely mentioning swallow
outside of a link should not be listed as a backlink.
Actual behaviour
The macro lists all pages containing swallow
, be it in a link or not. This clutters backlink listings with unwanted and useless links.
In our use case, we use backlinks as a sort oft tagging feature with auto-generated link lists. For example, we leave a [[Minutes]]
link on minutes pages. The backlink list of the Minutes
page then has a list of all minutes in the wiki.
Steps to reproduce
- Install the macro.
- Create a page mentioning
swallow
outside a link. - Create the wiki page
swallow
and insert the[[BackLinks]]
macro. - The page will list the page mentioning
swallow
, although it does not actually link to theswallow
page.
Possible Cause
The culprit apparently is the _get_backlinked_pages
method in macro.py, which, as far as I understand the SQL, merely scans for the page name, but does not even seem to attempts to check whether it actually appears in a link.
You may have better luck with TracBackLinkPlugin.