I'm getting an error, when using this on a website with multiple languages. I believe it's because of using the name, which changes depending on the language:
.Where(x => x.Name == "Project A").
But I tried removing that part and it seems to work fine. Is there any reason why that part has to be there?
If you're creating a website and then will later clone the DB to create a live instance it's usually OK to use the IDs or Guids of the content skeleton.. if you create the projects folder it will always be id 1234.
There might be a slight performance hit on searching for this node everytime rather than going straight to it.
Getting a specific page URL
Hi. I'm still really new to Umbraco and Razor.
I want to retrieve the URL of a specific page ("Project A"). In my content tree the page is nested as such:
Home > Projects > Project A
I have already used the following code to retrieve the URL of a page ("About"), that's on the same level as "Projects":
But I believe I have to go one level deeper now.
Hope you can help.
Hi,
There's a lot of ways of doing this.
If the page is always going to be the same you could hardcode the Id or Guid.
If you want to stay in the same vein...
Assuming the doc type for Projects is "projects" and Project A is "project". Change as appropriate.
I'm getting an error, when using this on a website with multiple languages. I believe it's because of using the name, which changes depending on the language:
But I tried removing that part and it seems to work fine. Is there any reason why that part has to be there?
Thanks.
As I said- there are a lot of ways of doing this.
If you're sure that it's always going to be the first project in the sort order then you don't need the name check.
Ok. Thanks.
Thanks! This is exactly what I was looking for.
I initially wanted to use the ID, but I believe IDs are different between environments.
Thanks again.
Hi,
They are if you use Courier and once you deploy.
If you're creating a website and then will later clone the DB to create a live instance it's usually OK to use the IDs or Guids of the content skeleton.. if you create the projects folder it will always be id 1234.
There might be a slight performance hit on searching for this node everytime rather than going straight to it.
Steve
is working on a reply...