If Iunderstandyour questioncorrectly, you tryto point thelinkto the pagespecified inumbracoUrlAliasalias.For example/index.aspx.Sothe linkgoes toindex.aspx.Isthis correctlyunderstood.IfI havetriedmy wayto a solution.Does not havemuch experiencewith the oldXMLschema.
But the way Ihad writtenthe link, soit goesto what isspecified inumbracoUrlAliasislike this.
So you want to redirect the index.aspx page to the root of the site is this correctly understood and all others pages mustgoto their pageurl. Or do you want, that you can specifyanypage to goto the rootof the site?,
It soundslike youhavesetuptheredirectioninWebConfigfileso /index.aspxgo to thesiteroot. Ihaveno experiencewithredirection, sounfortunately I cannothelp you further,sorry.
Although umbracoUrlAlias has a particular purpose of allowing alternate URLs to point to the same page, it should be accessible using the same method as any other data element on a node. However, I don't believe it actually stores the full URL, just the meaty parts. See this wiki article. So you'll have to build the URL and the way you build it will be different depending on whether you have .aspx extensions turned on or off. Also keep in mind that the umbracoUrlAlias allows multiple entries and if you are using that feature, you will need to parse the string further.
From your syntax I assume you are working in a pre 4.5 version of Umbraco. The following should work, assuming you are only including one alias.
Thanks for the extra info chris, that code snippet did the trick.
I've upgraded to 4.7 so I guess that's why <a href="{data[@alias='umbracoUrlAlias']}"> did'nt work? Maybe I should read release notes for syntax changes.
One thing to note, if you are on 4.7, you must still be using the legacy schema for those to work (an option in your umbracoSettings.config). I would recommend keeping that setting if it is working for you since changing it at this point may invalidate some of your XSLT code.
If you are using the new schema, simply referencing the name of the property instead of the data[@alias=...] syntax should work. One thing you will note is that I included a reference to the current node (using the ./ syntax) which you didn't have in your example. That is likely the critical difference.
Anyway, if that solved it for you go ahead and mark the solution so others can find it easily if they are having a similar issue.
Can't get value of umbracoUrlAlias property
I'm trying to return the umbracoUrlAlias property but struggling, I must be missing something.
I have in a document type a generic property called "Related Url", and it's alias is umbracoUrlAlias, it is a textstring.
On the page's content I have set the "Related Url" set to /index.aspx.
In the navigation xlst <a href="{umbraco.library:NiceUrl(@id)}"> returns the path no problem but
<a href="{data[@alias='umbracoUrlAlias']}"> returns nothing.
Is it something I should be checking for in the umbraco admin? does it need it's own datatype or macro/xlst?
I've got a datatype with macro already in called "relatedlinkslist.xlst" it's just the standard one.
Many thanks for any help!
Hi Pete,
If I understand your question correctly, you try to point the link to the page specified in umbracoUrlAlias alias. For example / index.aspx. So the link goes to index.aspx. Is this correctly understood. If I have tried my way to a solution. Does not have much experience with the old XML schema.
But the way I had written the link, so it goes to what is specified in umbracoUrlAlias is like this.
But as I said, I do not know if I have understand your question correctly. If I have, hope this can help you.
/Dennis
Hi Dennis
Yes that's exactly what I am trying to do. I actually want the "/index.aspx" to redirect to the root of the site.
But even if I put the property on other document types and the related url to another page, it doesn't work.
Do you have a code snippet of a choose / when to decide what to do with the url?
Pete
Hi Pete,
So you want to redirect the index.aspx page to the root of the site is this correctly understood and all others pages must go to their page url. Or do you want, that you can specify any page to go to the root of the site?,
Hope it's okay I put some questions to clarify
/Dennis
Yes that's correct dennis.
Pete
Hi again Pete,
It sounds like you have set up the redirection in WebConfig file so /index.aspx go to the site root.
I have no experience with redirection, so unfortunately I can not help you further, sorry.
/Dennis
Ok no problem dennis. I know exactly how to do urlrewriting in web.config so that's no issue, thanks.
I still don't understand why I can't get the umbracoUrlAlias working just on a normal page, ie page1.aspx to page2.aspx.
Pete
Hey Pete,
Although umbracoUrlAlias has a particular purpose of allowing alternate URLs to point to the same page, it should be accessible using the same method as any other data element on a node. However, I don't believe it actually stores the full URL, just the meaty parts. See this wiki article. So you'll have to build the URL and the way you build it will be different depending on whether you have .aspx extensions turned on or off. Also keep in mind that the umbracoUrlAlias allows multiple entries and if you are using that feature, you will need to parse the string further.
From your syntax I assume you are working in a pre 4.5 version of Umbraco. The following should work, assuming you are only including one alias.
No Extensions:
<a href="/{./data[@alias='umbracoUrlAlias']}">
Extensions:
<a href="/{./data[@alias='umbracoUrlAlias']}.aspx">
I don't currently have anything set up to test pre 4.5 syntax, however this should get you close.
--Chris
Thanks for the extra info chris, that code snippet did the trick.
I've upgraded to 4.7 so I guess that's why <a href="{data[@alias='umbracoUrlAlias']}"> did'nt work? Maybe I should read release notes for syntax changes.
Both;
<a href="/{./data[@alias='umbracoUrlAlias']}">
and
<a href="/{./data[@alias='umbracoUrlAlias']}.aspx">
Worked no probs.
Pete
Glad to hear its working for you.
One thing to note, if you are on 4.7, you must still be using the legacy schema for those to work (an option in your umbracoSettings.config). I would recommend keeping that setting if it is working for you since changing it at this point may invalidate some of your XSLT code.
If you are using the new schema, simply referencing the name of the property instead of the data[@alias=...] syntax should work. One thing you will note is that I included a reference to the current node (using the ./ syntax) which you didn't have in your example. That is likely the critical difference.
Anyway, if that solved it for you go ahead and mark the solution so others can find it easily if they are having a similar issue.
--Chris
is working on a reply...