statamic / wikilinks

Autolinks content wrapped in [braces], just like a wiki.
https://statamic.com
MIT License
1 stars 3 forks source link

Discussion: Handling changed entry titles #7

Open steveparks opened 1 week ago

steveparks commented 1 week ago

At the moment the addon is very simple, and simply looks for [entry title] in text and replaces it with a link to the entry.

But what if somebody writes Post 2, with a reference back to [Post 1]... and then someone else edits the title of Post 1?

At the moment that would result in the link failing and just showing as plain text rather than a link.

So, how could this be handled more gracefully?

Options:

  1. When a user changes a post title, the addon hooks into the save, searches for [post title] references in all other entries and updates them
  2. Change the point at which the link is identified and created. Instead of doing it on the fly at page generation time, do it at entry creation time, so the field content itself is updated to have a markdown style link in the format Entry title.
  3. As with number 2, but instead of creating a link, the addon at entry save time creates a custom markdown-like tag with the entry id, like [Entry title]{entry-id}. Then at page generation time, the addon creates a link by finding the uri for that page-id, and displaying it with the title in the tag.
  4. Have a way of identifying failing wikilinks and showing a widget in the admin panel, so editors can fix manually
  5. Instead of failing by not adding a link, create a path to a search page with the tag text as the search terms, so the user is taken to a list of likely relevant pages. (this could also create a log for the widget in number 4.
  6. Something else?