I'm trying to add the special id of the linked page as an rel-attribute to each a-Tag of the RTE. At the moment, the rel part is include in the link, but with "page:uid" it inserts the actual page ID and NOT the id of the linked page.
lib.parseFunc_RTE.tags.link {
typolink.parameter.append < lib.parseFunc.tags.link.typolink.parameter.append
typolink.ATagParams = rel={page:uid}
wrap < lib.parseFunc.tags.link.newWrap
}
For Example: The site "Contact" has the ID-number 210 but at the moment, i'm on the "start" page with the id = 11. Now I have a textlink at the page "start" to the "Contacts" page. The HTML part looks as follows:
<a href="contacts/" rel="11">contact</a>
But it should be like this
<a href="contacts/" rel="210">contact</a>
Or even better like this (with special data-attribute)
<a href="contacts/" data-relation="210">contact</a>
How can I get this? Many thanks in advance.
What you try to do is a bit tricky in TypoScript, but not impossible. You have to work on the arguments of the pseudo <link>
tag which look like 162 - some-class ...
- 162
is the page-id in this example.
# Simulating some content
page = PAGE
page.10 = TEXT
page.10.value (
<link 162 - some-class>Some page</link>
)
page.10.parseFunc =< lib.parseFunc_RTE
# Adjusting parsing instructions for pseudo links
lib.parseFunc_RTE {
tags.link {
typolink.ATagParams.append = TEXT
typolink.ATagParams.append {
stdWrap {
# having all link settings "162 - some-class ..."
data = parameters:allParams
# split by whitespace
split.token.char = 32
# use first item
split.returnKey = 0
# enforce integer values
intval = 1
}
noTrimWrap = | data-relation="|"|
}
}
}
<p class="bodytext">
<a href="/tests/some-page" class="some-class" data-relation="162">Some page</a>
</p>