Log in Sign up

Referencing a link to the current page while writing it?

Is there a way to reference the current page's URL while writing the post? I'd like to be able to create visible anchor links while I'm writing, but don't know of an easy way to include the post's URL.

I know that you can put {#anchor-link-name} on a line to create an anchor link so that https://domain.com/path/#anchor-link-name will bring you to that line.

I also know that if I use just a leading slash, it will append the slug to my base domain. i.e. [linked text](/some-slug] will automatically point to https://mydomain.com/some-slug. But how do include the path part before the post is published?

Here's my idea: two leading slashes to indicate it should include the page's full URL and then append whatever is referenced to the end of that.

That way, when writing, I could just put this text [๐Ÿ”—](//#anchor-link-name) {#anchor-link-name} next to a heading, and I'd get a visible bit of hypertext (the emoji) that links to a particular part of the very page its on.

The full thing:

## A super cool heading [๐Ÿ”—](//#super-cool-heading) {#super-cool-heading}

Or is there an existing way to accomplish the same thing?


a year ago, 3 replies   markdown   internal-links   Edit question

Does the following work?

## A super cool heading [๐Ÿ”—](#super-cool-heading) {#super-cool-heading}
Answered a year ago ยท Edit answer

Hot damn, it does! Thank you!

Answered a year ago ยท Edit answer

Here it is in action, if anybody wants to see.

Answered a year ago ยท Edit answer