How come links are not redirecting to a heading on a different page on the updated Confluence?

After the new update links are no longer redirecting to a certain heading with the Advanced link option (My page#My heading). When I click on a link it takes me to the desired page, but it doesn't scroll the page down to the heading.


Before the update everything worked out smoothly. But I discovered today that links are no longer working correctly and this causes me problems because there are a lot of pages and a lot of links that need to be connceted.


What should I do? Does anyone else have this problem?


Thanks!

1 answer

2 votes

I wrote this Javascript to be able to link to anchors that are within expand blocks, but it also checks if an anchor link is missing the page title and adds it automatically, which might be the issue that is preventing your pages from working properly. Maybe you could try it?

from https://jira.atlassian.com/browse/CONFSERVER-27357?focusedCommentId=673236&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-673236 

<script>
var expandAnchor = function() {
  var hash = decodeURIComponent(window.location.hash);
  if (hash) {
    var hashPageTitle = AJS.params.pageTitle.split(" ").join("");
    if (hash.indexOf(hashPageTitle) === -1) {
      if (jQuery.isNumeric(hashPageTitle.substring(0,1))) {
        hash = "#id-" + hashPageTitle + "-" + hash.slice(1);
      } else {
        hash = "#" + hashPageTitle + "-" + hash.slice(1);
      }
    }
    var escapedId = hash.replace(/[!"$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&");
    jQuery(escapedId).parents('.expand-container').children('.expand-hidden').prev().click();
    window.location.href=hash;
  }
}
AJS.toInit(function() {
  expandAnchor();
  jQuery(window).bind('hashchange', function() {
    expandAnchor();
  });
});
</script>

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Tuesday in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

455 views 18 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you