Hi, I am planning to publish blog posts and would like to add hyperlinks to post headings, usually on websites the links appear as a paper link where the user can click to copy the URL. Wanted to know if this is possible?
Yep this is possible, by adding
#heading-name to the end of the URL you create a link that will jump to the heading on the page.
Here’s an example from the Casper Demo site:
https://demo.ghost.io/design/#installing-ghost-themes (copy and paste this URL into your browser and you’ll land on the heading “Installing Ghost themes”)
Thank you so much for this! This is great. If I want my blog posts to automatically generate
#heading-name so those paperclips/links are automatically generated within the post so a reader can copy the link themselves would I need to add
#heading-name within the posts file?
Do you want something like this? https://codepen.io/chriscoyier/pen/MWKybrQ
The header ids are already output by Ghost automatically so a script like the one shown in the demo can be used to show a “paper link click-to-copy” UI in any way that fits with your site.
If you don’t want to edit your theme to add such a script it can be added in the Code Injection settings but you may want to find some way to limit it to running only on your individual posts because hyperlinks added on index pages won’t be permalinks (old posts will eventually appear on different page numbers, breaking any links that were copied).
Thank you, that is exactly what I was looking for. Will test it out and try and limit it to just posts.