Links to different page parts


Does anybody know if it’s possible (and if so, how) to link different parts of the same page (at different scrolls).


Hi @GDB! This is possible with good ol’ HTML. If you want to use sub-headers for example, you can use the id attribute. Here’s an example post where I link to a second header section in the post:

To accomplish this, I simply wrote out the subheader with HTML and put in the ID — something short that makes sense.

<h2 id="second">Second Header</h2>

Then all you have to do is link to it by taking your post’s link and adding a hash with the id’s name. So in the above’s case, #second. This creates the general link:

Doing this with Markdown is extended syntax that we’d definitely look into if there was demand.

Hope that makes sense and helps! Would be glad to clarify further if need be.

Count me in as someone who would want to do this via Markdown. I have also done it using html and ids, but it would be great to be able to handle it with Markdown.


This is Gdb, thanks for your response.

What if I was looking for a solution that did not involve a header?


So what did you have in mind @GDB? All you need to do is add the id to whatever HTML element in your post you had in mind to link to & use the hash in the url as referenced above.

I think I understand the concept.

Thank you!

1 Like

The problem I’m having is that I need to create navigation links to other header sections within the same page, but when I click on them it opens a new page tab (navigating to the specified header) rather than navigating to that header within the same page. Thus I get a proliferation of open tab pages whereas I want to stay within the same page.

Creating links to other sections of the same page should work according to various references, such as this one. But it appears that something is happening in such that a new page is opened rather than navigating to the link within the same page.

I’ve tried specifying target="_parent" and target="_self", but that doesn’t work.

Does anyone know how to get this to work?

Ah got it — how about something like this?

<a href="#second"><h2 id="second">Blah Blah Blah</h2></a>

I have a demo here where, if you click the link on the first line, it will go to that part in the post without opening a new page tab. Let me know if that works @bugbuster!

Thanks cj, but it didn’t work in a blog post. Here’s the very strange thing - it works in an anonymous post just as you described, but does not work in a blog post."

Something appears to be different in blog posts vs anonymous. Any ideas?

@cjeller1592 Another strange thing - It appears to be exclusively a blog post thing. I tried it in blog posts on two different WriteFreely instances and it worked perfectly in both.

Thanks for keying in on where it’s happening @bugbuster — that helps a lot actually! There might be something different with the codebase that is causing this to happen. We’ll look into it and I’ll keep you posted (unless @matt jumps in).

1 Like