Last active
February 23, 2021 22:19
-
-
Save wvuwebgist/cc5cb00847eb166f5346f3c79be7fb73 to your computer and use it in GitHub Desktop.
Generate a URL to a background image from a label and output that to a style tag in the head (Liquid).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign background1 = site | first_random_image_tagged_with: label: "backpage-1-hero" | image_url: size: "1780x580" %} | |
<style> | |
.example { | |
background-image: url('{{ background1 }}'); | |
} | |
</style> | |
<!-- OR: --> | |
{% assign background2 = site | first_random_image_tagged_with: label: "backpage-1-hero" | image_url: size: "1780x580" | css_background_image %} | |
<style> | |
.example { | |
{{ background2 }} | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment