<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Add custom image to each collection</title>
    <link>http://forums.shopify.com/categories/1/posts/30647</link>
    <language>en-us</language>
    <description>Feed for discussion topic Add custom image to each collection</description>
    <item>
      <title>Add custom image to each collection</title>
      <author>swd</author>
      <pubDate>Thu, 29 Oct 2009 18:57:22 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647</guid>
      <description>&lt;p&gt;I have a test shop set up and at the top of each of the main pages I have a main image to distunguish each section. I can easily add an image for the collection template through the theme.liquid file, but how can I target a specific collection?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To target the collection template, I have this in the theme.liquid file...&lt;/p&gt;
&lt;p&gt;{% if template == "collection" %}&amp;lt;div id="homefeaturedimage"&amp;gt;&amp;lt;img src="{{ 'home.jpg' | asset_url }}" /&amp;gt;&amp;lt;/div&amp;gt;{% endif %}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I've guessed at a bunch of combinations to target a specific collection without any luck, such as&lt;/p&gt;
&lt;p&gt;{% if template == "collection.jewelry" %}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And I've read through all the documentation that I can find...Any suggestions?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jamie commented</title>
      <author>Jamie</author>
      <pubDate>Thu, 29 Oct 2009 19:10:03 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30649</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30649</guid>
      <description>&lt;p&gt;I would put these in the collection description area then you don't have to deal with a bunch of conditional soup. [see screen]&lt;/p&gt;</description>
    </item>
    <item>
      <title>swd commented</title>
      <author>swd</author>
      <pubDate>Fri, 30 Oct 2009 13:09:58 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30661</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30661</guid>
      <description>&lt;p&gt;Thanks, that's an option, but it doesn't allow me to place it in the layout where I would like it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any idea where I could find some of this conditional soup?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jamie commented</title>
      <author>Jamie</author>
      <pubDate>Fri, 30 Oct 2009 13:57:48 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30662</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30662</guid>
      <description>&lt;p&gt;How does that stop you from placing it where you want in the layout?&lt;/p&gt;
&lt;p&gt;In you can place {{ collection.description }} anywhere you want. Where are you trying to drop the collection image?&lt;/p&gt;
&lt;p&gt;If you want to go the conditional soup method you need a case statement. Something along the lines of...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;{% case template %}
    {% when 'collection' %}
        {% if collection.title == 'mycollectiontitle' %}
             [do this]
        {% elsif collection.title == 'myothertitle' %}
             [do that]
        {% else %}
             [do something else]
        {% endif %}
{% endcase %}&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
    </item>
    <item>
      <title>swd commented</title>
      <author>swd</author>
      <pubDate>Fri, 30 Oct 2009 17:49:17 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30672</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30672</guid>
      <description>&lt;p&gt;That's exactly the soup I needed! thanks&lt;/p&gt;
&lt;p&gt;It wouldnt work in the collection description only because I have a conditional on the theme.liquid page telling it to pull a different image depending on every template, and I couldn't figure out a way to target each of the collections specifically to get that done, but I added in what you wrote out and it works...&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jamie commented</title>
      <author>Jamie</author>
      <pubDate>Fri, 30 Oct 2009 19:45:14 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30679</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30679</guid>
      <description>&lt;p&gt;Great! The beauty of pulling the collection.description is that it's dynamic and will pull in the image only for the *currently* viewed collection.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Todd412 commented</title>
      <author>Todd412</author>
      <pubDate>Tue, 10 Nov 2009 00:41:16 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30888</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30888</guid>
      <description>&lt;p&gt;I am trying to something similar, though less complex than it sounds like what you're doing swd. &amp;nbsp;However I'm not sure I understand how to implement your solution Jamie.&lt;/p&gt;
&lt;p&gt;I have a bunch of "smart" collections, and for each, I have an image I would like to display on its page. &amp;nbsp;I tried your suggestion Jamie of using the "insert an image into the text" feature, and I can see that it's producing html within the text description. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, I don't want the image to be inline with the text-- I want to be able to place the image elsewhere on the page within my custom theme's layout. &amp;nbsp;But the html that it gave me when I uploaded the image appears very specific to this one image:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;
&lt;pre&gt;&amp;lt;img src='&lt;a href="http://cdn.shopify.com/s/files/1/0036/1722/files/collection_pic_527_395.jpg?1257810803"&gt;http://cdn.shopify.com/s/files/1/0036/1722/files/collection_pic_527_395.jpg?1257810803&lt;/a&gt;' alt='' /&amp;gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So it seems the only way I refer to those images within my collection.liquid files is if I used the "conditional soup" approach to determine which specific image to insert based on the collection's name... is there a better way?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jamie commented</title>
      <author>Jamie</author>
      <pubDate>Tue, 10 Nov 2009 01:35:45 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/30647#comment-30889</link>
      <guid>http://forums.shopify.com/categories/1/posts/30647#comment-30889</guid>
      <description>&lt;p&gt;You could try {{ collection.description | truncate: 1 }} or &amp;nbsp;2 or 10. Keep bumping that number until you just get the image&amp;nbsp;and only the image. Then you can put that anywhere on your collection page. I don't have anything up at the moment to test that, but it should work if you want to avoid a complicated conditional set-up. You may have to get your collection images re-named with all having amount of&amp;nbsp;characters in their file names. Like I said that's the lazy way of doing it.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
