How to use "locallink" in a razor-template (7.0.1)
Hello,
I just can't figure out how to use the old <...href='/{locallink:1071}'...> in a template using razor. I want to "hardlink" some stuff like copyright just inside the template but of course using locallink-mimik and not directly linking on the url.
What Charlie probably means is that hardcoding an ID is not super portable if you have a staging/production setup. They could potentially become out of sync (different ID on each server). The chances are pretty low but the better way would be to navigate the tree structure and find a 'copyright' doctype or something like that. That way it's agnostic to whatever ID it ends up with.
It's a matter of taste, style and requirements.
Possible ID-free alternative (not tested of course):
Kevin, yes exaclty and it can change. You should not really just have a hard link. If its content within Umbraco then it should come from Umbraco and be allowed some scope for change with out breaking code.
How to use "locallink" in a razor-template (7.0.1)
Hello,
I just can't figure out how to use the old <...href='/{locallink:1071}'...> in a template using razor. I want to "hardlink" some stuff like copyright just inside the template but of course using locallink-mimik and not directly linking on the url.
What syntax do I have to use?
Thanx! Arnim.
Comment author was deleted
You could try something like this:
So many ways to skin this cat, here's another option:
Comment author was deleted
@Jeavon, nice. I didn't know that was even an option.
I would be very worried hard coding a Node id in there. Charlie :)
@Charlie: Why? Isn't it much better than hard coding a url?
If I want links (like contact, copyright, search,... ) on every page - isn't that the only solution?
@Kevin, Jeavon: Thanx a lot - work like a charm! Marking Jeavons, cause its more "obvious".
Thanx for all your fast replies!
Comment author was deleted
What Charlie probably means is that hardcoding an ID is not super portable if you have a staging/production setup. They could potentially become out of sync (different ID on each server). The chances are pretty low but the better way would be to navigate the tree structure and find a 'copyright' doctype or something like that. That way it's agnostic to whatever ID it ends up with.
It's a matter of taste, style and requirements.
Possible ID-free alternative (not tested of course):
Kevin, yes exaclty and it can change. You should not really just have a hard link. If its content within Umbraco then it should come from Umbraco and be allowed some scope for change with out breaking code.
sorry for my late reply Amim
is working on a reply...