You can just use normal page URLs like your example above, but best to put a slash at the start so the path is always relative to your document root. Note, the drawback with this method is is that if the page name changes your link will break. So to tackle this you could use the following syntax:
Where the number is the id of the page node (which you can find in the properties tab of the page in the content section). Umbraco will swap this out before rendering and will output a standard relative link. This way, even if the page name changes the link will be maintained.
I think the formatting on the forum might screw this up, as I think it has done above, but inside the href attribute, try putting {localLink:1099} including the curly braces, where the number is the id of the node you want to link to.
internal page linking with anchor tag
Well, It’s seems stupid question but I can't figure out how to do this,
like if somewhere in my html I want to redirect to another umbraco page how do i do this.
<a href="somepage.aspx">somepage</a> ?
if yes then what about nested sub page?
i want to know the best practice to do this.
Thanks
Hi Deepali,
You can just use normal page URLs like your example above, but best to put a slash at the start so the path is always relative to your document root. Note, the drawback with this method is is that if the page name changes your link will break. So to tackle this you could use the following syntax:
Where the number is the id of the page node (which you can find in the properties tab of the page in the content section). Umbraco will swap this out before rendering and will output a standard relative link. This way, even if the page name changes the link will be maintained.
Thanks alot Dan,
It works like Charm!!
: )
Hi Dan,
This does not work for me as all I am getting is the node id instead of the web page name.
Bob
Hi Bob,
I think the formatting on the forum might screw this up, as I think it has done above, but inside the href attribute, try putting {localLink:1099} including the curly braces, where the number is the id of the node you want to link to.
Hi Dan,
Say for example I have a related links object called abc, when i call this object in the xslt
<a href="{abc)}">
<img src="{umbracoFile}" width="500" height="320" />
</a>
it should output the page i.e mysite.com/news.aspx and not mysite.com/1234?
This is a basic function as there are loads of images all over the website that require linking to internal webpages.
Hi guys,
Im just going to hardcode the links thanks for your help
Bob
Ah, you're doing this in XLST? The above is for directly in templates. In XSLT to render a URL from a node id you'll need to do something like this:
<a href="{umbraco.library:NiceUrl($abc)}"><img src="somthing.jpg" /></a>
Where $abc is the node id variable.
is working on a reply...