Ray-Ban brands use a number of different platforms to engage with their customers, often including Tumblr. Persol approached Stinkdigital wanting a new theme for their Tumblr page, which was looking outdated, and was clogged up with jQuery plugins.
Internally, the project was designed and ready for build - but nobody had written themes for Tumblr before. The designers, who were most familiar with Tumblr, spoke about the development as “just a Tumblr theme”, but the reality was that the coding process was going to be seriously limited by the platform.
After a heavy learning curve, and some discovery into using either the Theme builder or a custom JS single-page app and their API, a choice to use a combination of methods was made; mostly relying on the Theme builder, with enhancements added using the API.
The theme is written using theme tags which allowed me to check if the user is viewing an index page (such as the homepage, or a search page) or a permalink page (for a specific post).
A lot of Tumblr theme coding falls down to hacking their theme tags. For example, you can use the following tag to check if the user is on an index page:
… which is great; but the content shown here will be the same for the homepage, any search results and tag pages. If you want to have homepage-only style (which you almost always do) you have to write some pretty ugly code:
This comments out the homepage only code on search result pages. It’s not pretty, but it’s the best solution at the moment.
Alex Coady is a freelance React / Redux developer based in London.
© Alex Coady 2016