I have a Component that contains a field as Component Link. I would like to assign a hyperlink to that Component. What is the equivalent of <a tridion:href="TCMID">text</a>
for a Razor Template?
My Previous code is:
<a [email protected]>Learn More... </a>
I got it not resolved and my html page shows as below
<tridion:componentlink textonfail="true" linkattributes="" linktext="" addanchor="false" templateuri="tcm:0-0-0" componenturi="tcm:348-13853" pageuri="tcm:348-13905-64">
Learn More...
</tridion:componentlink></li>
and after as per suggesstions i modified the code as below
<tcdl:Link type="Component" origin="@Page.ID"
destination="@incomps.Fields.SecondBlockComponentLink.ID"
templateURI="@ComponentTemplate.ID" linkAttributes="" textOnFail="True"
addAnchor="False">
Learn More...
</tcdl:Link>
But its failed on deployment phase of publishing and the error is
Stack: TAG: (0) Param=false Mode=0
Class=com.tridion.tcdl.tags.DefaultTagHandler ------
, Unbalanced tags in TCDL file Closing Tag
cdl:Link does not match tcdl:ComponentPresentation
How to resolved the below HTML output of Tridion Component Link
<a tridion:href="@incomps.Fields.SecondBlockComponentLink.ID">Learn more...</a>
-- you're only outputting the TcmID into a link?<a href=@ID>
did not get resolved, but you did have a<tridion:componentlink>
tag in your output? That means it did get resolved correctly. The error you see when you use the TCDL tag, seems to indicate there is some incorrect HTML, that could be from a Page Template or a Component Template, you will need to debug the templates to find out where it goes wrong, or place the entire code of them in your question (try simplifying them first to reduce the amount of code and possibilities for error). But I'm certain you don't need the TCDL.