copy link with text highlighted in a website2 min read • 18 Feb 2023
Ever wondered, when you search for some query on google, you get a nice minimal answer from a long blog post or article, and when you open that article that particular text or group of text gets highlighted. In case you haven't seen that here's a demo-
How does it work?
For the above demo, the link is -
If we look closely, the link has #:~:text= at the end of the website path. So the structure of url to form such a link is-
# structure of url https://yourwebsite.com/path/to/article/#:~:text=the text you want to highlight
And here is a demo url, where you can verify the above - https://akulsrivastava.com/about#:~:text=Hey%20there%2C%20I%20am%20Akul
How to create a link with text highlighted
- Go to the website and select the text which you want to highlight.
- Right-click on the text
- Select Copy link to highlight
Highlighting multiple texts
To get the link with multiple texts highlighted, manual effort is needed i.e. structuring the url by ourselves in the following format-
https://website.com/your/path/#:~:text=this is text 1&text=this is text 2
Demo Url - https://akulsrivastava.com/about#:~:text=Hey there, I am Akul&text=I also like to explore opensource projects