glensc / dokuwiki-plugin-pageredirect

Redirects page requests based on content
https://www.dokuwiki.org/plugin:pageredirect
19 stars 19 forks source link

Partial support for backlinks with redirects #26

Closed michitux closed 7 years ago

michitux commented 7 years ago

In response to #3, this adds partial support for backlinks. The support is partial in the sense that the index is only updated when the page containing the link is updated and not when a new redirect is created. Consider the following example: A links to B. Now a redirect is created from B to C. C won't list A as page linking to C unless A is updated.

I'm not really sure how to fix this cleanly. As noted in the source, a possible fix could work as follows: When adding a page to the index that contains a redirect, all pages linking to that page are found and re-indexing them is triggered by deleting their .indexed meta-file. Alternatively, it could be possible to update their index directly, but this is a bit problematic as the originally saved values cannot be easily retrieved externally (even though they are available). If the index should only be correct for the target page, the renameMetaValue-method of the indexer could be used. If you want to find the pages linking to the current page, make sure you do not use ft_backlinks, but the underlying method of the indexer directly as ft_backlinks respects ACLs.

Further, chained redirects are not considered, too.

glensc commented 7 years ago

merge partial implementation, better than nothing. thanks!