When saving translated node content that contains named anchors a URL path to the original language content item is prefixed to the link. For example

  • Create new content node using English language (path node/100)
  • Add a named anchor < a name="test-anchor" > The anchor < /a >
  • Add a link to the anchor < a href="#test-anchor" > The link to anchor < /a >
  • Create a translation in Spanish and save it (path node/101)

When the Spanish translation is saved the link gets rewritten to < a href="/node/100#test-anchor" > which makes it link to the English translation. If the Spanish link is edited to use the correct node < a href="/node/101#test-anchor" > then everything works correctly but if the link is reset to < a href="#test-anchor" > is will get rewritten incorrectly again. The English language link works correctly all the time.

I know this is due to Drupal rewriting the link but it is picking up the original language URL and not the current edit page url which makes me think its due to i18n providing the wrong URL. To clarify I am editing node/101 and when I save it rewrites the link to node/100.

I have looked through the code but cannot find what could be causing this. If anyone could point me in the right direction I could probably create a patch.

Comments

Anonymous’s picture

Same issue. Subscribing.

Janec’s picture

Component: Code » Blocks

Same issue here.

Janec’s picture

Component: Blocks » Node
Priority: Normal » Minor
Status: Active » Needs work

Accidentally changed issue settings. Hopefully those are corrected now.

Just to say I found a workaround:

  • create nodes in both languages separately. This way anchor links keep doing what they are supposed to.
  • link nodes in the translation tab.

Kind regards,

Janec

joseph.olstad’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)