Liquid global_asset_url: How to Get Global Asset URL in Shopify
Drive 20-40% of your revenue with Avada
Many store owners find it challenging to efficiently load and use common resources across their site. This guide will show you how to use Liquid’s global_asset_url filter to easily retrieve Global Asset URLs in Shopify.
Whether you’re looking to improve your store’s loading speed or streamline your code, mastering this technique is crucial. Learn how to access Shopify’s centralized assets like JavaScript libraries and CSS files with just a few lines of code. Discover the power of global_asset_url and optimize your Shopify store’s performance today.
How to Get Global Asset URL in Shopify
About Global Asset URL in Shopify {#about-global-asset-url}
By permitting or denying access to a website, the URL filters are considered as the best way to control access to Internet websites. In addition, based on information which is contained in the list of URL, the users can store this list on Websense or Secure Computing URL filter. Besides, internet users enable maintaining the local URL as well as create the link for collection filters and blogs. In many URL filter outputs, you will see a question mark ?
with a number appended. In Shopify’s servers, Global Asset URL which is kept in as a tool to improve the loading speed of a page.
The way to get global asset
Step 1: Input
Input
{{ 'prototype.js' | global_asset_url | script_tag }}
Step 2: Output
After entering the input, the output will be like that:
Output
<script src="//cdn.shopify.com/s/global/prototype.js?1" type="text/javascript"></script>
The following global assets are available:
{{ 'prototype.js' | global_asset_url | script_tag }}
{{ 'controls.js' | global_asset_url | script_tag }}
{{ 'dragdrop.js' | global_asset_url | script_tag }}
{{ 'effects.js' | global_asset_url | script_tag }}
{{ 'prototype/1.5/prototype.js' | global_asset_url | script_tag }}
{{ 'prototype/1.6/prototype.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/scriptaculous.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/builder.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/controls.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/dragdrop.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/effects.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/slider.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/sound.js' | global_asset_url | script_tag }}
{{ 'scriptaculous/1.8.2/unittest.js' | global_asset_url | script_tag }}
{{ 'ga.js' | global_asset_url | script_tag }}
{{ 'mootools.js' | global_asset_url | script_tag }}
{{ 'lightbox.css' | global_asset_url | stylesheet_tag }}
{{ 'lightbox.js' | global_asset_url | script_tag }}
{{ 'lightbox/v1/lightbox.css' | global_asset_url | stylesheet_tag }}
{{ 'lightbox/v1/lightbox.js' | global_asset_url | script_tag }}
{{ 'lightbox/v2/lightbox.css' | global_asset_url | stylesheet_tag }}
{{ 'lightbox/v2/lightbox.js' | global_asset_url | script_tag }}
{{ 'lightbox/v2/loading.gif' | global_asset_url }}
{{ 'lightbox/v2/close.gif' | global_asset_url }}
{{ 'lightbox/v2/overlay.png' | global_asset_url }}
{{ 'lightbox/v2/zoom-lg.gif' | global_asset_url }}
{{ 'lightbox/v204/lightbox.css' | global_asset_url | stylesheet_tag }}
{{ 'lightbox/v204/lightbox.js' | global_asset_url | script_tag }}
{{ 'lightbox/v204/bullet.gif' | global_asset_url }}
{{ 'lightbox/v204/close.gif' | global_asset_url }}
{{ 'lightbox/v204/closelabel.gif' | global_asset_url }}
{{ 'lightbox/v204/donatebutton.gif' | global_asset_url }}
{{ 'lightbox/v204/downloadicon.gif' | global_asset_url }}
{{ 'lightbox/v204/loading.gif' | global_asset_url }}
{{ 'lightbox/v204/nextlabel.gif' | global_asset_url }}
{{ 'lightbox/v204/prevlabel.gif' | global_asset_url }}
{{ 'list_collection.css' | global_asset_url | stylesheet_tag }}
{{ 'search.css' | global_asset_url | stylesheet_tag }}
{{ 'textile.css' | global_asset_url | stylesheet_tag }}
{{ 'firebug/firebug.css' | global_asset_url | stylesheet_tag }}
{{ 'firebug/firebug.js' | global_asset_url | script_tag }}
{{ 'firebug/firebugx.js' | global_asset_url | script_tag }}
{{ 'firebug/firebug.html' | global_asset_url }}
{{ 'firebug/errorIcon.png' | global_asset_url }}
{{ 'firebug/infoIcon.png' | global_asset_url }}
{{ 'firebug/warningIcon.png' | global_asset_url }}
Conclusion
The global_asset_url filter in Shopify’s Liquid is a powerful tool for accessing and utilizing shared resources across your store. By following the steps outlined in this guide, you can efficiently retrieve Global Asset URLs, improving your store’s performance and code organization. Take action now to implement these techniques in your Shopify theme.
Remember, leveraging global assets not only streamlines your code but also enhances page loading speeds, contributing to a better user experience. As you continue to develop your Shopify store, mastering Liquid filters like global_asset_url will prove invaluable in creating a more efficient and professional e-commerce platform.
In addition, the Shopify store owners can discover more these articles about Liquid URL filters such as: