Jump to content

Anchors not Working in Pages


Bendensin

Recommended Posts

I'm trying to create a FAQ using the Articles system in Pages. I know there is a FAQ system app, but I have many different FAQ topics which coincide with article topics, and I need to keep evertything in the same place.  I have everything set up but the anchors and links.

I have linked questions at the top of a page, with answers below, on the same page. I want to have a link in each question, which takes the user down the page to an anchor next to the answer (typical FAQ setup). But when I click on the linked question, it opens a the same page in new browser window, and then drops down to the anchor.

In an FAQ article about residence permits, here's what I have done so far:

Using the "Anchor" button in CK Editor, I inserted an anchor at the left of the answer towards the bottom of the page, and called it "where-apply." The anchor HTML looks like this:

<span style="font-size:18px;"><strong><a id="where-apply" name="where-apply"></a>Where do I apply for my residence permit?</strong></span>

Then I went to the top of the page, highlighted the question, and clicked the "Link" button in CK Editor. In the dialog box, I entered #where-apply as the link URL. The link HTML looks like this:

<a href="http://#where-apply" rel="external">Where do I apply for my residence permit?</a>

Of course that goes to a non-existent page.

Next I double-clicked on the link to open the Link Dialog box. Two opened up. The one on top gives the option for link type as ""Link to anchor in text," so I selected that. For anchor name, I selected "where-apply" from the drop-down list. The example URL still said

http://#where-apply

So I removed the "http://" part. Then I saved the link and saved the page.

I clicked on the link, but then it went to the URL "http:///#where-apply" (note three backslashes), and I got the error "The address isn't valid."

How can I create an anchor at the bottom of a page, with a link going to it from the to of the page, and simply have the user go to that anchor on the same page when they click the link?

Link to comment
Share on other sites

  • 3 weeks later...

It's done using the anchor button in the CKEditor. IPB seems to keep over-riding it and entering the "http://" part. I'll report it as a bug.

I'm adding the following for anyone else experiencing problems with same-page anchors:

I tried changing it in the HTML code, but

rel="external"

keeps being appended at the end when I save it. I checked my settings in my admin CP, and under System => Settings => Posting => URLs I have it set to "Force posted links to open in new windows? = Yes. Apparently this is supposed to apply to links to other websites, but it's also forcing same-page links to anchors to also open in a new window. I'll add it to the bug report.

 

Link to comment
Share on other sites

  • 1 year later...

Same problem (4.2.3). I want to create single landing page and use a nav menu for a create anchor links. But it can't save with #anchor. If i hardcode this link in template - it work (move to the anchor in page), but address line changed to bad link. Example https://example.com/#anchor moved to right id, but address line changed to https://example.com/anchor. Very unusable thing. Will be happy if this problem will fixed as a part of core cms without my custom menu reinvent of right wheel.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...