This project is read-only.

Creating an Anchor Tag on a Page in Orchard

Topics: General
Oct 24, 2012 at 9:30 PM
Edited Oct 24, 2012 at 9:31 PM

I've created a new page in Orchard.  At the top of the page I have a list of links, and below that, a large amount of content.  Each link at the top of the page when clicked should bring you to a specific place on the same page.  Using the Insert/Edit link functionality in the GUI, I've set up each link to have a Link URL that looks like this (but they each have a unique name):


The "Target" drop down has "-- Not Set --" selected, and I've left the "Title" field blank.  

And then the corresponding anchor further down on the page would look like this (but with the corresponding unique name), which I've set using the HTML editor:

<a name="section1"></a>

When I view the page after publishing it, and I click on one of the anchor links at the top of the page, it does bring me to the part of the page that I would expect.  However, it is completely hiding all of the content above that section/anchor. I would expect to be able to scroll up to an earlier point on the page if I wanted to, but I can't.  

I create anchor links like this pretty regularly when developing outside of a CMS, and the way I'm doing this, I would expect it to work, but I am also very new to Orchard.  Am I missing something?  Why would it hide all of my content above the anchor after I've clicked to go to the anchor spot?  Does the # sign trigger some other behavior in Orchard?

Thanks in advance!

Oct 25, 2012 at 7:16 AM

This has absolutely nothing to do with Orchard. It knows zilch about your anchors and doesn't affect them.

Oct 25, 2012 at 2:55 PM


Oct 25, 2012 at 4:45 PM
Edited Oct 25, 2012 at 5:17 PM

It might have something to do with used theme and its css.

Oct 25, 2012 at 4:51 PM

Thanks, I think you're correct.  I tried creating a bare bones site with a single page and the default theme, and then tried the same thing.  It worked perfectly. And then I was able to find the bit in my site.css that was causing my anchor problem.  (I should have tried that before posting here, sorry.)

Oct 25, 2012 at 5:23 PM

Forum is for questions and discussions, don't regret posting here...