Skip to main content
2 of 2
added 211 characters in body
Chris
  • 122
  • 5

Convert links in content to internal form?

If I create a hyperlink inside a text field (such as node body) with an internal path uri such as "node/1234" or "index.php?q=taxonomy/term/5678", then I can use an input filter such as pathologic to convert that uri at display-time to the preferred alias uri, such as "http://example.dev/path/to/my/content"

(I would consider this a more resilient way of storing content than using the full aliased uri)

However, I can't see an easy way for a non-technical user to find an internal path uri and paste it in. Is there any way to get drupal to spot when a user has inserted an alias-based link into the content, and convert it into an internal path uri before saving to the database? I know the menu module does this with links, using drupal_get_normal_path(), but can it be done for html links in the content? Ideally with an existing D7 module?

For example, content like <p>More info at <a href="http://example.dev/info">this link</a></p> would be converted to <p>More info at <a href="node/123">this link</a></p> before saving into storage.

Also, is there any existing online discussion about the advisability of this approach?

Chris
  • 122
  • 5