Removing spaces from tag for social share

Hey All

I’d like to include my primary tag as a hashtag for Twitter and Facebook shares. Obviously, if I just use {{}} in the URL string it’ll come out as #Getting Started (with a space between getting and started) instead of #GettingStarted. How do I remove the spaces from the URL string?


You should do the entire social share part from javascript and then append the code.
If you use ghost API to get primary_tag name then you can easily remove the white spaces from the tag. That would be much easier process.

If you want to hire an expert for custom ghost development-related work you may feel free contact us.

Hi @themeix

Thanks for the reply. Is it possible to point me in the direction of the code or tutorial?



These would help you.

1 Like


Thanks for the info. This doesn’t really help with the process of putting the code together.

I understand you want to sell your services, but perhaps you can do this elsewhere?

I’ll await someone willing to share the code.



You Can Use

1 Like

You misunderstood me. if i really wants to sell the service only then i never shared any ref. url to you.

Btw i just set up a fresh ghost and then prepare the code for you. I hope its good to go. But definitely you need some idea about javascript to implement that.

    .browse({limit: 1, include: 'tags'})
    .then((posts) => {
        posts.forEach((post) => {
		var post_tag_name = ;
        console.log( post_tag_name.replace( /\s/g, '') ); 
    .catch((err) => {

Output Resut

Ref :

1 Like