I am needing to include a unique ID on each item listed for my banner image slider but the external ID only shows as the value 0.
<div class="scale-timer" data-background="{{this['Image']}}" id="{{this['ExternalId']}}"></div>
I am looking to use this as a means for setting different images to be loaded subject to the media type by setting the background images using media queries in my CSS. This of course means I have to manually set this but the pagespeed benefit far outweighs the cost of doing so. I would set the default bg image to the smallest image by default.
Does anyone else have an alternative suggestion they feel might be better
Well just after reading Adam Wilson update to Liquid documentation I found {{this.id}} and tried that and it gave me my external id. Question is why doesn’t the component I selected work as expected?
I think ‘externalID’ is only if you import items and provide your own ID, otherwise it’ll be 0.
But if you export the list of Custom Web items the excel file first column is ExternalID and indeed contains the value of the item ID
Hmm, it was my understanding that externalID was just a kind of initial reference, so you could import to create items with your our ID (the system would take on that ID from then on).
I guess it includes it in the export so if you reimport it works the same way and knows to override those items.
If you were to reimport i’d say the externalID would then be populated - but it’d be the same as ‘this.ID’
That’s my assumption anyway 