How to fix this siteMap?

A

active

I've been reading the help but find much on programmiccally doing it but
nothing on using XML.

I have the following from an example and want to add a top menu item
"History" and two menu items under that: History1 and History2. The top menu
item should not open a page - simply show the two sub menu items. I know
what I have is not right. I don't think I should even have a Top.aspx file.
But I have no idea how to fix it.



Can you help?



<?xml version="1.0" encoding="utf-8" ?>

<siteMap>

<siteMapNode title="Home" url="Default.aspx">

<siteMapNode title=" History" url="History/Top.aspx" />

<siteMapNode title="History1" url="History/His 1.aspx" />

</siteMapNode>

<siteMapNode title="History2" url="History/His 2.aspx" />

</siteMapNode>

How to fix the above??






<siteMapNode title="Links" url="Links.aspx" />

<siteMapNode title="Albums" url="Albums.aspx" >

<siteMapNode title="Photos" url="Photos.aspx" >

<siteMapNode title="Details" url="Details.aspx" />

</siteMapNode>

</siteMapNode>

<siteMapNode title="Register" url="Register.aspx" />

<siteMapNode title="Login" url="Login.aspx" />

<siteMapNode title="Manage" url="Admin/Albums.aspx" >

<siteMapNode title="Photos" url="Admin/Photos.aspx" >

<siteMapNode title="Details" url="Admin/Details.aspx" />

</siteMapNode>

</siteMapNode>

</siteMapNode>


</siteMap>
 
M

Mike Mueller

I'm still learning how to use the sitemaps, so I do not know
if this one will work. I did notice you have some whitespace
in the URLs, and I would recommend that you lose it or
replace it with hyphens or underscores

<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"<siteMapNode title="Home" url="Default.aspx">
<siteMapNode title=" History" >
<siteMapNode title=" History"
url="History/Top.aspx" />
<siteMapNode title="History1"
url="History/His 1.aspx" />
<siteMapNode title="History2"
url="History/His 2.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>




: I've been reading the help but find much on
programmiccally doing it but
: nothing on using XML.
:
: I have the following from an example and want to add a top
menu item
: "History" and two menu items under that: History1 and
History2. The top menu
: item should not open a page - simply show the two sub menu
items. I know
: what I have is not right. I don't think I should even have
a Top.aspx file.
: But I have no idea how to fix it.
:
:
:
: Can you help?
:
:
:
: <?xml version="1.0" encoding="utf-8" ?>
:
: <siteMap>
:
: <siteMapNode title="Home" url="Default.aspx">
:
: <siteMapNode title=" History" url="History/Top.aspx" />
:
: <siteMapNode title="History1" url="History/His 1.aspx" />
:
: </siteMapNode>
:
: <siteMapNode title="History2" url="History/His 2.aspx" />
:
: </siteMapNode>
:
: How to fix the above??
:
:
:
:
:
:
: <siteMapNode title="Links" url="Links.aspx" />
:
: <siteMapNode title="Albums" url="Albums.aspx" >
:
: <siteMapNode title="Photos" url="Photos.aspx" >
:
: <siteMapNode title="Details" url="Details.aspx" />
:
: </siteMapNode>
:
: </siteMapNode>
:
: <siteMapNode title="Register" url="Register.aspx" />
:
: <siteMapNode title="Login" url="Login.aspx" />
:
: <siteMapNode title="Manage" url="Admin/Albums.aspx" >
:
: <siteMapNode title="Photos" url="Admin/Photos.aspx" >
:
: <siteMapNode title="Details" url="Admin/Details.aspx" />
:
: </siteMapNode>
:
: </siteMapNode>
:
: </siteMapNode>
:
:
: </siteMap>
:
:
 
A

active

Thanks to both of you.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="History">
<siteMapNode url="history1.aspx" title="History 1" />
<siteMapNode url="history2.aspx" title="History 2" />
</siteMapNode>
</siteMap>

The above works but below doesn't

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="Home" url="Default.aspx" />
<siteMapNode title="History">
<siteMapNode url="History/One.aspx" title="One" />
<siteMapNode url="History/Two.aspx" title="Two" />
</siteMapNode>
</siteMap>


The addition makes History an "invalid child element"
If I put Home below </siteMapNode>
it becomes the invalid one.

I've tried two </siteMapNode>
I've tried other things, it appears that the second main level item is
always the problem.


Thanks again for the replies
 
A

active

I can make it work.
Take off the / before the >
And add a url to History.
Not sure why I need the url!
Thanks again for the help
 
A

active

I think I now know that sometime there is no ending slash, like in
<siteMapNode title="Home" url="Default.aspx">
and that a
</siteMapNode>
closes it.

I believe not noticing that caused my problem.

I want to thank you again for your help.
 
A

active

I think I now know that sometime there is no ending slash, like in
<siteMapNode title="Home" url="Default.aspx">
and that a
</siteMapNode>
closes it.

I believe not noticing that caused my problem.

I want to thank you again for your help.
 
A

active

thanks

David Longnecker said:
Your <siteMapNode title="History"> doesn't have the /> because the /> is a
closing tag. Your "child nodes" would be ignored. The </siteMapNode>
encapsulates the child nodes and acts as the closing tag for this
scenario; this is commonly called a container tag.

You typically only use the <tag attribute="value" /> layout for tags
commonly called empty tags.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top