Add Anchors to PageMenu

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
9/13/2010 9:10:56 AM
Gravatar
Total Posts 76

Add Anchors to PageMenu

I have been trying to wrap my head around the best way to add anchors to a few pages.

I am looking for suggestions.

I need them to be inside the pagemenu.ascy, so as they look the same and are handled the same. But they are just anchors to locations in a long piece of content. 

I thought about ways to do this...

create dummy pages, and change the urls so they were really just anchors... but this made maintainability horrible... as I dont want my end users having to go to the URL manager to fix links...

the next is far more intensive.... building out a custom PageMenu for said pages that has a ability to add/edit links that are not backed by a virtual page in the cms..

Any-thoughts?

 

9/13/2010 10:47:19 AM
Gravatar
Total Posts 2253

Re: Add Anchors to PageMenu

Hello,

I think you were on the right path with the "dummy" pages idea except that you do not need to have the users work with the URL manager. When you create the "dummy" page, change the URL, before saving the page, to the desired page+anchor. For instance, if I want an item in my menu named "History" to link to the history section on my "About Us" page, I would create a new page under the "About Us" page and set the URL to "http://mywebsite.url/about-us.aspx#history". This would make the link displayed in the menu open the about us page and move the browser focus to the "history" anchor.

I have a couple clients using this method and they seem to grasp it fairly well. One additional step I have given them is to use the anchors created by the modules instead of creating their own. I did this for 2 reason really, 1) to ensure the module title is shown if the section the link is pointing to is actually a module and not a set area of text within a module and, 2) one can't easily add an anchor to most of the modules (Feed Manager, File Sharing, etc...). The anchors created by the modules are simply the word module + the module id. To find the module id, hover over the settings or edit link of a module and you will see "mid=000" in the URL (where 000 is the module id). To create the link to a module with an id of 29, use "http://mywebsite.url/page-name.aspx#module29".

HTH,
Joe D.

9/13/2010 10:56:54 AM
Gravatar
Total Posts 76

Re: Add Anchors to PageMenu

Thank Joe, I just wanted to see what others were doing before i got too deep into the rabbit hole...

9/13/2010 1:31:00 PM
Gravatar
Total Posts 76

Re: Add Anchors to PageMenu

Just tried to do this, and the # gets stripped when saving the Page?

9/13/2010 1:49:52 PM
Gravatar
Total Posts 2253

Re: Add Anchors to PageMenu

Hi,

Make sure you are using the full URL  to the page. You can't use a relative URL with an anchor. So you will need "http://mywebsite.url/page-name.aspx#anchorname".

HTH,
Joe D.

9/15/2010 11:57:02 AM
Gravatar
Total Posts 76

Re: Add Anchors to PageMenu

Development Requests:

I think it would be handy to allow users to add anchors that are ~/mypage.aspx#myanchor, ( i surely want it... as i have multiple levels of staging )

perhaps a check-box that alters the stripping of chars in the url ?

 

9/15/2010 12:16:22 PM
Gravatar
Total Posts 18439

Re: Add Anchors to PageMenu

The problem is if we allow that then the friendly url will be saved with /mypages.aspx#myanchor and therefore the url mypages.aspx won't work because it does not exist in the database.

9/15/2010 2:03:38 PM
Gravatar
Total Posts 76

Re: Add Anchors to PageMenu

I already have the friendly url "~/pagename.aspx" created.

Now I need Anchor Sub Links ( in the pagemanu.ascx  ) to the parent  page ( "~/pagename.aspx" )

But I need to these sub links to no be a full fledge page, i just need the URL so it can be used as a html anchor

so the nav would be:

[~/pagename.aspx]

-- [~/pagename.aspx#anchor1 ]

-- [~/pagename.aspx#anchor2 ]

[ ~/someotherpage.aspx ]

 

So yes, the parent page of ~/pagename.aspx will already to exist

9/15/2010 2:28:11 PM
Gravatar
Total Posts 2253

Re: Add Anchors to PageMenu

Hi Joe,

In this case, he is not wanting to have the menu link to the page he is creating. He is wanting to have the menu link to an anchor on another page that has already been created. This used to be possible with the relative URL but it changed recently and only the full URL will work with anchors now. I can't tell you when this changed as I didn't notice it until recently on a customer site. I know it used to work because I have sites with page urls set with the relative url and an anchor.

Let me know if I am clear as mud.

Thanks,
Joe D.

9/15/2010 2:54:02 PM
Gravatar
Total Posts 18439

Re: Add Anchors to PageMenu

Hi Joe,

Sorry but I have to disagree on this one. Neither the friendly url system nor the menus was ever designed for using anchors and trying to accommodate that is only going to introduce problems. I actually tried allowing # in the friendly urls today on my local machine and I ended up with an infinite redirect loop.

If it works using fully qualified urls thats great but I'm not going to muck with the friendly url system right now, it is complicated enough supporting all the scenarios we intend to support like folder based child sites and I don't want to break it.

My recommendation is if you want links to anchors put it in the content at the top like a table of contents and create links there to section anchors of the same document or else use a fully qualified url, or put a links module on the side with links to the anchors. 

Sorry if this does not meet everyone's needs, maybe I will reconsider looking into it at some point but not right now or in the near term.

Best,

Joe

9/15/2010 3:20:06 PM
Gravatar
Total Posts 76

Re: Add Anchors to PageMenu

Thanks guys~  

You must sign in to post in the forums. This thread is closed to new posts.