How to get the right link in the RTE for the right content culture?
I'm having a bit of trouble with the RTE in Umbraco 10, especially with the links within the content.
I have a surfacecontroller to build an e-mail, using content from the RTE.
This content is available in multiple languages. Getting this content is no problem.
But the URL that's returned, when getting the content, is in the wrong culture.
So, I have an RTE with some text and a link, pointed to the node /en/about-us/company. This page (about us/company) is also available in dutch and german.
If I try to retrieve the text like this:
Node.Value<IHtmlEncodedString>("Content", "en-US")
I get the english content. But the link in my content is pointing to /over-ons/bedrijf (the dutch name of the selected node) instead of /en/about-us/company.
Now people receiving the e-mail in english, will have a link to a dutch page.
How can I make sure the link to the node is in the same culture as the content I'm trying to retrieve?
It's working fine for me on v13.4.1, Should be the same on v10.
var node = _context?.EnsureUmbracoContext()?.UmbracoContext.Content?.GetById(54164) as Home;
const string culture = "da-dk";
_variationContextAccessor.VariationContext = new VariationContext(culture);
var node1 = _context?.EnsureUmbracoContext()?.UmbracoContext.Content?.GetById(54164) as Home;
I had some RTE in my HOME doc type, it was pulling correct urls. That was me just checking the default culture and danish one and both were fine. I am not sure if it’s something with v10.
How to get the right link in the RTE for the right content culture?
I'm having a bit of trouble with the RTE in Umbraco 10, especially with the links within the content.
I have a surfacecontroller to build an e-mail, using content from the RTE. This content is available in multiple languages. Getting this content is no problem.
But the URL that's returned, when getting the content, is in the wrong culture.
So, I have an RTE with some text and a link, pointed to the node
/en/about-us/company
. This page (about us/company) is also available in dutch and german.If I try to retrieve the text like this:
Node.Value<IHtmlEncodedString>("Content", "en-US")
I get the english content. But the link in my content is pointing to/over-ons/bedrijf
(the dutch name of the selected node) instead of/en/about-us/company
.Now people receiving the e-mail in english, will have a link to a dutch page.
How can I make sure the link to the node is in the same culture as the content I'm trying to retrieve?
Hi Jeroen,
Have you tried with IVariationContextAccessor?
I hadn't. I didn't even know about it.
But it doesn't seem to make a difference either.
It gets even weirder. If I do this:
The URL is gone. I get:
The URL is replaced with a
#
If I do this:
So, getting the content, then settings the
variationContextAxxessor
and then getting the content again, I get english text but a dutch URL.It's working fine for me on v13.4.1, Should be the same on v10.
It works, as far as the content is concerned. But the link within my RTE content just turns to a
#
as soon as I use the VariantContextAccessor.It doesn't matter if I retrieve the node before or after the VariantContextAccessor.
I had some RTE in my HOME doc type, it was pulling correct urls. That was me just checking the default culture and danish one and both were fine. I am not sure if it’s something with v10.
is working on a reply...