Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am trying to embed anchor links on a page that was built with sections. I use the Turbo Theme from Out of the Sandbox. Since the page is built in sections, I can't use the rich text theme editor on the page itself. Also, the page-template.liquid simply has the available sections, not the actual sections used, so I can't embed there. As I see it, the only place I see reference to the actual spots where I want to anchor are in the settings_data.json. Anyone know how I can implement anchor tags in the .json?
Thanks for your help!!!
Solved! Go to the solution
This is an accepted solution.
Just updated my theme yesterday. I now have the Custom HTML section available. Thanks!
Create new sections, for Custom HTML.
Use something like
<span id="anchor_a"></span>
Slide them just above the section you are moving to, and target those with the links 🙂
Thanks for the reply Duncan.
Did you mean to add the section in the templat.liquid or in the .json?
When your in the theme customizer, you should be able to add a new section. Usually the last section option you can use is "Custom HTML"
Happy to take a look (no charge) if you want to provide your .myshopify.com address and I will send you a collab request
This is an accepted solution.
Just updated my theme yesterday. I now have the Custom HTML section available. Thanks!
Hi, Could you provide detailed steps (for a non-coder!) in how to do this? I would like two of the items in my Header to link to sections on my homepage, but I can't figure out where exactly to put the anchor link. Thank you!
Hey there.
Depending on your theme, a lot have a Section called "Custom HTML" or "Custom Content" This is literally a Section where you can put in any HTML/CSS/Javascript you want and it will load. You would add that, and use the above code.
Then for your links, you would have it point to
#Anchor_Name_here
Best Regards.
Thanks for the quick reply! I have a "custom-html.liquid" section that already has a bunch of code in there. I'm confused as to where to drop that line of code in. Everyone keeps saying to "place the code above the section you want to link to", but what does that mean? There aren't any section names listed in the code. (Sorry, I'm clearly not a coder...and am loathe to hire someone for something seemingly so simple.)
aye, but one thing to remember. Physics is simple to some, and hard for others. Its ok to hire for small things as long as you dont over pay 😉
In the customizer, down the left side you should see the sections you can place and move around. If you don't, you might have a wicked old theme in which case you would need to go hard code the Anchors in.
Hello @Miss
I tried what you recommended with the dawn 2.0 templace.
I added custom liquid <span id="anchor_b"></span> right before the place I want the link to move down. But i'm stuck there.
I tried to add a link such as this
#Anchor_Name_here
but it doesnt work.
Could you please help me with the last part. How can I create the link and make sure it goes down to the anchor I created wih custom liquid section.
Thank you
Did you manage to find a solution for this @petitlaurierco ?
Trying to add an Anchor Link into an index.json file also (I want to add the anchor link to a "Shop Now" button, then for it to scroll down to another section on the homepage).
@Misfit_Code_Dev I also have the Dawn theme, have updated to the latest version and there is no Custom HTML section available as an option. The only option I can see is to edit the JSON file and I only know how to write plain HTML. So I'm stuck here.
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024