Locksmith
Install LocksmithContact us
  • Quick Start
  • đź’ˇBasics
    • A Locksmith Overview
    • Creating locks
    • Creating keys
    • Compatibility with other apps and Shopify features
    • Removing Locksmith
  • 🔆Tutorials
    • Approving customer registrations
    • Creating restricted wholesale products
    • Hiding product prices and/or the add to cart button
    • Selling digital content on Shopify
    • More tutorials...
      • Setting up multiple price tiers
      • Customizing messages
      • Customizing the customer login page
      • Customizing the registration form
      • Customizing the passcode form
      • Customizing Locksmith’s "Access denied content" messages, and redirecting customers
      • Customizing the email list signup form
      • Showing multiple prompts on the same page
      • Showing content only to specific Markets
      • Input lists
      • Protecting against bots
      • Earn recurring revenue on your exclusive content using ReCharge
      • Use Locksmith and PayWhirl together to grant access based on subscriptions
      • Liquid locking basics
      • Restricting checkout from the cart
      • Confirmation key condition
      • Restricting customers to a specific collection
      • Passcode-specific redirects
      • Grow your subscriber lists with Klaviyo
      • Use Klaviyo as an access control list
      • Use Mailchimp to collect customer emails
      • Hiding out-of-stock products
      • How to use a private browsing session
      • Granting access to variants by visitor input
      • Offering different variants by postal code
      • Locking products by tag
      • Locking multiple pages at once
      • Making a product accessible exclusively from the direct product link
      • Creating private team areas
      • Importing customers in bulk
      • Disabling Locksmith for certain theme files
      • Adding translations to your Locksmith messages
      • Redirecting using Locksmith
      • Locking variants
        • Limiting the scope of variant locks using the product tag key condition
        • Handling JavaScript DOM errors caused by variant locks
      • Locking the customer registration form
      • Locking the search results page in your store
      • How to clear cache for a single website
      • Disabling Locksmith for certain theme files
      • 🛠️Manual mode
      • Grant access for a limited time when using passcodes or secret links
      • Testing Locksmith on unpublished themes
      • Locking blog posts
      • How to access your browser's dev tools
      • Restricting the cart for mixed products and combinations of products
      • Locking products by vendor
      • How do I hide my Shopify store's header and footer
      • Hiding navigation links for locked resources
      • Hiding products from product-grids
      • Restricting a product so that it can only be purchased by new customers
      • Automatically managing the seo.hidden metafield using Locksmith
      • Locking the home page
      • Setting up checkout validation with Locksmith
      • How to hide theme sections, blocks, and snippets
  • 🔑Keys: Access methods in Locksmith
    • About key conditions
    • Customer account keys
    • Passcode keys
    • Secret link keys
    • Visitor location keys
    • More about keys...
      • Inverting conditions in Locksmith
      • Combining key conditions
      • "Has purchased..." key
      • Using the "Force open other locks" setting
      • Custom Liquid key-condition basics
      • Manual mode
      • Excluding content from locks
      • IP address keys
      • Newsletter keys
      • Limiting the scope of variant locks using the product tag key condition
  • 🌻FAQs
    • Why aren't my locks working?
    • FAQ: I see blank spaces in my collections and/or searches when locking
    • Can Locksmith hide content from my in-store search?
    • Locksmith is not working with my page builder app
    • What should I do if my site is loading slowly?
    • I'm the administrator of my site and I cannot access pages because of Locksmith locks.
    • More FAQs...
      • I'm having trouble using Locksmith with a site speed optimization app.
      • The app isn't loading. What do I do?
      • Can Locksmith protect shipping methods, billing methods, or coupon codes?
      • I switched themes, and Locksmith isn't working
      • Why isn't my passcode, secret link, newsletter, or location key working?
      • Can Locksmith lock Shopify's public JSON API for my online store?
      • Why are my customers seeing a reCAPTCHA when logging in?
      • My passcode or newsletter prompt is not updating on my store when I change it.
      • My featured collections on my home page only show one product.
      • My infinite scrolling doesn't show all of my products.
      • My customers have to enter their e-mail address into the Mailchimp key every time they visit.
      • How do I know which customers have used a certain key?
      • Why is Locksmith adding information to my orders?
      • Locksmith isn't installing correctly!
      • Locksmith is not uninstalling correctly!
      • How does Locksmith affect search engines and SEO?
      • How do I change where customers are redirected to after registration on Shopify
      • The thing I want to lock isn't showing up in the Locksmith search
      • I am getting an "already taken" error when trying to create a metafield definition for seo.hidden
      • How do I add a hero banner image to Locksmith's access messages
  • đź“’Policies
    • Usage agreement
    • Locksmith's pricing policy: Pay what feels good
    • Privacy policy
    • Data policy
    • Contact us
  • 🔦Developer Tools
    • Locksmith Admin API
    • Locksmith Storefront API
    • Locksmith variables
    • Unsupported functionality
    • Requests from Locksmith
  • More developer docs...
    • Using the Admin API with Locks
  • App Integrations
    • Easy Appointment Booking
Powered by GitBook
On this page
  • Adding a hero banner above your access content:
  • Hero banner CSS and HTML:
  • Customising this example:
  • Modify this code to display a collection-specific banner image (advanced):
  • Uploading and storing images:
  • Related articles:

Was this helpful?

Export as PDF
  1. FAQs
  2. More FAQs...

How do I add a hero banner image to Locksmith's access messages

This guide provides an example of how to add a banner image above your access message content in your Shopify online store.

PreviousI am getting an "already taken" error when trying to create a metafield definition for seo.hiddenNextUsage agreement

Last updated 6 months ago

Was this helpful?

Note: While we can provide examples and guidance, we're unable to write custom code for individual store customisations. This example is meant as a starting point for your own implementation.

Locksmith's access messages can be modified using text, HTML, CSS, JavaScript and Liquid code. We cover this and where to edit Locksmith's access messages in our customising messages guide, linked below:

Adding a hero banner above your access content:

The following code can be added to your "Guest message content" field, above your existing message:

Hero banner CSS and HTML:

<style>
    .hero-image {
        /* Replace the URL here with the URL to your image */
        background-image: url("https://www.w3schools.com/howto/photographer.jpg");
    
        /* Set a specific height */
        height: 300px;
        
        /* Position and center the image to scale nicely on all screens */
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
        position: relative;
    }       
</style>
            
            
<div role="banner" class="hero-image">
</div>

Customising this example:

  • To replace the example image with your own, replace the URL with the quotes for the background-image with the URL of your banner image

  • Adjusting the height of the hero banner by changing the height value (300px in this example) to suit your needs

Modify this code to display a collection-specific banner image (advanced):

This section describes how to modify a Shopify image URL so that Locksmith’s default access message content can be used to display collection-specific hero banners.

It’s possible to add some Liquid code if you would like to display a collection-specific banner image to multiple collections without needing to customise the above code for each image and then applying that to each collection lock.

To set this up:

  1. Image titles:

    You’ll need to title each banner image with the corresponding collection handle. For example, if your collection is located at my-store.myshopify.com/collections/collection-a, then the image title for this collection should be collection-a.

  2. Image file types:

  3. Image file paths:

    Images stored with Shopify will have a file path similar to the following example, where the image is titled collection-a:

    https://cdn.shopify.com/s/files/1/1234/5678/9012/files/collection-a.jpeg

    This path should remain the same for all your images, except for the image title.

  4. Modifying the image link:

    You can modify a link for one of your images by replacing the image title with the following Liquid:

    {{ collection.handle }}

    This will give you URL like this:

    https://cdn.shopify.com/s/files/1/1234/5678/9012/files/{{ collection.handle }}.jpeg

  5. Updating the style code:

    The URL can then be added to the background-image style element’s URL.

  6. Editing the default message content:

(Optional) Limiting the scope of the hero banner code to collection and product pages:

The banner code can be wrapped in some Liquid so that it runs only on collection and product pages. Here’s an example of Liquid for this purpose:

{% if template == "collection" or "product" %}
  banner code goes here
{% endif %}

Uploading and storing images:

Related articles:

The above code is based on an example from W3 School, here:

Make sure all your collection banner images are of the same file type. This can be any file type compatible with (or wherever you’ve stored your images), so long as they’re consistent.

are located in the Locksmith app’s Settings tab. By adding this modified hero banner image code to a message field in Locksmith’s settings—instead of a specific lock’s settings page—the code will apply to any lock that is using the default message.

Shopify has some documentation on uploading and managing files here:

🌻
Customizing messages
https://www.w3schools.com/howto/howto_css_hero_image.asp
Shopify’s file requirements
Locksmith’s default access messages
https://help.shopify.com/en/manual/shopify-admin/productivity-tools/file-uploads
Customizing messages
Customizing the passcode form
Customizing the email list signup form
Example image of where the above example code can be added to the "Guest message content" field to include a hero banner above the lock's guest message content.