Try our conversational search powered by Generative AI!

Html.ContentLink not generating link with CatalogContent but works with Pages


CMS 12.3.2

Commerce 14.1.3

Code in view

Serialized value of content link 

The old code works but in the migrated code it doesn't

Edited, Jul 28, 2022 9:35

Hi Mark,

Is Html.ContentLink not generating your anchor tag + link in CMS12? But it was working in CMS11?

Then in the title of your post you mention it works with cms pages but catalogue content?

Edited, Jul 31, 2022 19:14
Mark Malinao - Aug 01, 2022 6:32
Hi Surjit,

I also logged ticket to Optimizely, they were able to make it working on their end. Its just weird thing on my end that it doesn't work. And yes it works in CMS Pages but not in catalog content. I might missing some configuration or something.

Hello Mark, 

Dos it work for you?

_urlResolver.Service.GetUrl(contentReference, language);
Aug 09, 2022 11:49

Cna you query your Root Node and see what it's resolving to?


Aug 09, 2022 14:17

Thank you everyone for the replies.

Currently i tried to create ContentLink and only working in Root Category

Aug 10, 2022 6:33

Sorry for the incremental questions but my next one was:

if you were to manually navigate to https://localhost:5000/068/Electronics , would it resolve to your category page?

Also try https://localhost:5000/068/{seo url property of electronics category}

Aug 10, 2022 8:08
Mark Malinao - Aug 10, 2022 8:16
Actually not, thats the other issue what im trying to resolve. Because that actually what im trying to achieve. I might missing something in config?
Surjit Bharath - Aug 11, 2022 1:23
Your catalog node seems to be resolving correctly in your screenshot so at the moment I'm leaning towards your category not being able to resolve a view correctly.

Html.ContentLink will return an anchor tag if there's a controller associated with the category. If not then it will return a span with the name of the category in there. Which is consistent with what your experiencing.

Can you double check your category controller inherits from ContentController and its generic parameter is your category node?
Mark Malinao - Aug 12, 2022 9:55
Yes, i have CategoryController that inherits ContentController. The thing here is that ContentLink is being drawn as ViewComponent which i already have implementation. I've replied the images below for the ViewComponent

Aug 12, 2022 9:57

Hi everyone, i was able to resolve this issue by changing the ContentController<NodeContent> to ContentController<Category>

I don't know the exact reason why using NodeContent in ContentController doesn't work in newer version of episerver. 

Sep 12, 2022 9:17
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.