Fluorescent
Spark
Spark
  • Spark Help Center
    • Start using Spark
      • Migrate your theme
      • Theme licenses
    • FAQs
    • Changelog
  • General
    • Editing themes
      • Adding sections
      • Using templates
      • Accessibility
      • Customizing your site
      • H1 headings tags
      • SEO for Shopify themes
      • Online store speed
    • Image guide
      • Web ready photography
      • Image sizes
      • File formats
      • Theme image settings
    • Adapting theme content
      • Edit default theme content
      • Multiple languages
      • Dynamic content with metafields
      • Unique content for markets
    • Update your theme
      • Upgrade to OS2
  • Theme styles
    • Theme settings
    • Style presets
    • Fonts
    • Colors
    • Animation
    • Buttons
  • Pages
    • Templates
      • About page
      • Blogs page
      • Blog posts template
      • Collections list page
      • Contact page
      • FAQ page
      • Lookbook page
      • Password page
      • Search page
      • 404 page
      • Home page
    • Sections
      • Blog posts
      • Collection list
      • Countdown banner
      • Events
      • Featured collection
      • Featured collection row
      • Featured product
      • Image with features
      • Image with text
      • Inline features
      • Logo list
      • Map
      • Mosaic grid
      • Newsletter
      • Questions and answers
      • Quotes
      • Rich text
      • Shoppable feature
      • Shoppable image
      • Slideshow
      • Social proof
      • Testimonials
      • Text columns with images
      • Video
      • Video hero
    • Popups
  • Header
    • Header
      • Logo
      • Layout and style
      • Transparent header
      • Customer account link
    • Announcement bar
    • Quick search
  • Footer
    • Footer
      • Links block
      • Newsletter block
      • Text and image block
      • Payment icons
      • Language selector
      • Country selector
      • Social media icons
      • Footer text
  • Products
    • Product listings
    • Hover add-to-cart
  • Cart
    • Cart page
    • Fly-out cart
  • Product pages
    • Product template
      • Pre-order template
      • Alternate product template
    • Layout and style
      • Breadcrumbs
      • Navigation buttons
      • Media gallery
      • Quick purchase bar
      • Gift recipient form
    • Product overview blocks
      • Default blocks
        • Title
        • Price
        • Description
        • Variant selector
        • Quantity selector
        • Buy buttons
        • Local pickup banner
        • Share icons
      • Accordion block
      • Complementary products
      • Custom text field
      • Information popup
      • Payment accordion
      • Security accordion
      • Shipping accordion
      • Stock level indicator
      • Text block
      • App blocks
    • Product page sections
      • Product reviews
      • Recommended products
    • Variant options
      • Variant chips
      • Variant swatches
        • Use default colors
        • Use custom colors
        • Use custom images
        • Show on product cards
        • Dynamic option availability
      • Sibling product swatches
  • Collection pages
    • Collection template
    • Banner
    • Product grid
    • Filters and sorting
  • Support
    • Support policy
    • Shopify vs Theme issues
    • Store access requests
  • For developers
    • Custom CSS
    • Custom fonts
    • Custom Liquid
    • Custom JavaScript events
    • Edit Theme JavaScript
Powered by GitBook
On this page
  • Add Custom Liquid section
  • Add anchor links to sections

Was this helpful?

  1. For developers

Custom Liquid

Advanced

Last updated 3 months ago

Was this helpful?

We do not support code customizations. This guide offers a basic reference for advanced users familiar with HTML and Liquid. Always test code changes on unpublished theme copies. For assistance, we recommend reaching out to a .

With the Custom Liquid setting, you can extend your theme by adding snippets of Liquid or HTML code as a block or section in the theme editor.

Custom Liquid provides a reliable and safer option compared to directly editing your theme code. It will help keep your theme copy eligible for updates and avoid conflicts with the original theme code.

This guide shows how to add a Custom Liquid section and provides an example for adding anchor links to sections.

Add Custom Liquid section


Follow the steps below to add Custom Liquid section and test your custom code.

Liquid is the template language used by Shopify. See their to learn more. Also check out Shopify's .

STEPS

In your Shopify admin:

  1. Click Duplicate on your current theme.

  2. Click Customize on the duplicated, unpublished theme version.

In your theme editor (Customize):

  1. Open a Template.

  2. Under Template, click (+) Add section and select Custom Liquid.

  3. Click the Custom Liquid section to open the settings.

  4. Enter your HTML or Liquid code into the Custom Liquid field.

    Refer to Shopify's to learn more.

  5. Click Save.

  6. Click Preview to review your changes.

    Use the preview link to further test your changes on multiple browsers and devices.

  7. After testing, you can Publish the theme with your changes.

Add anchor links to sections


Shopify dynamically generates ids for sections but these ids are not stable. The following instructions are a workaround for this platform limitation.

To link to a specific section on a page, you can use a Custom Liquid section with some HTML as a workaround. The HTML will include a special id property that will allow you to link directly to that section.

Once set up, the Custom Liquid section will not affect the page layout.

Anchor link in the Header doesn't work? If your anchor link in the navigation menu points to a section on the same page, you will need to disable page transitions for the link to work. Go to Theme settings > Animation and deselect Enable page transitions.

STEPS

In your theme editor (Customize):

  1. Under Template, click (+) Add section and select Custom Liquid.

  2. Click and hold the drag and drop handles ⋮⋮ to move the Custom Liquid section directly above the section you want to link to.

  3. Click the Custom Liquid section to open the settings.

  4. Enter the following HTML code and enter a unique id property in the opening tag. If using multiple words, you must use dashes (-) instead of spaces.

    <span id="our-values"></span>

    Recommended: Use an ID that's the same name as your section, and make sure the name is not used by other IDs.

  5. Click the Custom CSS tab, and enter the code below to remove section padding:

    div {padding: 0px; margin: 0px;}

  6. Find and click the section or block that will link to the Custom Liquid section.

  7. In the link field, enter the id with a hashmark at the start (e.g. #our-values).

    To link from another page or menu link, you must enter the full URL path with the anchor link at the end (e.g. www.store.com/#our-values or www.store.com/about#our-values).

  8. If adding the anchor link to the navigation menu, you will need to disable Page transitions in Theme settings > Animation. Otherwise, the link will not work for sections that are on the current page.

  9. Click Save.

\


Related links

verified Fluorescent partner
Liquid reference guide
Liquid code examples
Liquid reference guide
Edit theme JavaScript
Custom Liquid
Custom CSS
Custom fonts