Camel Camel Camel-elion
So, for my wishlist, I kept trying to find a way link to
CamelCamelCamel (henceforth "🐫🐫🐫") if the store was Amazon. I
thought of adding another field to the wishlist JSON
file, but that
adds more work for me. If I get the correct URL, I could probably just
slice up the link and make one that works for 🐫🐫🐫.
Cut to the Chase Product ID
It appears that the, canonical URL format for Amazon links is in
the form of https://amazon.com/dp/1234567890
. Which means the last
~10 characters are the product ID. Similarly, 🐫🐫🐫 uses that in their
link structure: https://camelcamelcamel.com/product/1234567890
. Hmm.
{{- if strings.Contains .store "Amazon" }}
{{ $prod := substr .url -10 -}}
{{ $cccL := printf "https://camelcamelcamel.com/product/%s" $prod -}}
<a class="camels" title="Check the price history on CamelCamelCamel" href="{{ $cccL }}" rel="nofollow" target="_blank">🐫🐫🐫</a>
{{ end -}}
Et voila!
Lipstick for That Camel
Now, just style it up real fancy:
#wishlist .camels
{
display: block;
font-size: x-large;
margin: 0.8rem 0;
text-decoration: underline dashed 2px #CCC;
text-underline-position: under;
}
Now they get fancy price history links. And I can stop pestering them to make sure they get a good deal by checking for such things. 🎉
Editor's Notes
Could I have done this, possibly, with an API request or some other fancier lookup that isn't so fragile? Yeah. I could. I also don't care.