I am using the Upscale theme, which has a customizable Collection header template, with a layout option called “Fixed width with soft background.” This soft background is just a color, with variable opacity in the theme editor.
My goal is to modify the existing code for this “soft background”, so that when it is selected, a background image is shown instead of a color. I have added the following code to the custom CSS box for Collection header:
.color-soft-background {
background-image: url(myimagefile.jpg) !important;
background-repeat: repeat-y;
background-size: 100%;
}
This works beautifully, but the problem is I want each different collection page to show a different header image. I have set up a collection metafield for this, but I’m not a great coder, and I have no idea how to incorporate a metafield into the above code.
My first instinct was to try something like this:
.color-soft-background {
background-image: url({{ collection.metafields.custom.collection_header_image }}) !important;
background-repeat: repeat-y;
background-size: 100%;
}
…but that didn’t work.
Any advice?
