sitefinity-10

Sitefinity: How to add link in the header from backend?


Let me explain more about the page orientation.

Used
|_ Forklift
|_ Boomlift
|_ Specs

Every time you wanna see the list of forklift you go to "/Used/Forklift". You can see the all the forklifts. There may be several same model with same capacity used forklifts. So when users click on a specific item/forklift, they get redirected to the common page "Used/Specs/"; in addition we send 2 additional parameter (bold ones in the url). So the url looks like this;

http://localhost:60876/used/specs/used-forklifts/2015-hyundai-160d-7a-ls10151

Now, we have a widget on the "Specs" page; using these two parameters widget controller calls an API to get forklift details; on Sitefinity side we don't have any model (Nothing in the module), all done by the scripts to populate forklift details. That's not a problem, all working fine.

I set the page not to show Canonical url it doesn't show that; fine as well. But how can I add a custom link in the head from the server side? Something like the following;

                HtmlLink canonicalLink = new HtmlLink();
                canonicalLink.Attributes.Add("rel", "canonical");
                canonicalLink.Attributes.Add("href", "test");

And I have something like this;

I have tried so many things nothing works. Thank you for your help. My Sitefinity version is 10.2.6631.


Solution

  • You can check this blog post that shows how to remove (if exists) and add a canonical link in Sitefinity. You can modify it a bit to fit to your needs.