Hacking Squarespace Bedford Galleries

I'm loving the new Bedford template on Squarespace (you're looking at it) the only thing I felt was missing was the gallery pages don't have the banner and title text.

After a quick chat with support (absurdly eager to help) I was told the gallery lack of banner goodness was by design so it didn't clash with the gallery content itself.

That makes sense on reflection, but the banner text itself would still be cool to have. This post is my solution v1 and I'm sharing for it everyone else to use.

It works as follows:

  1. the page loads with the "Header Flag" called injectMe
  2. the page renders and the footer code executes
    1. does the page have the meta tag injectMe?
    2. if yes, get the page description from the header (Squarespace adds this by default, even if the page doesn't use it)
    3. grab and remove the page content
    4. join the page description with the page content and insert into the page

More details can be found on github, including the code. Github is really just a simple web site for sharing code, you don't have to sign up to see the solution. I expect the code to refine over time, and you're more than welcome to take the code and use it in any way you see fit, including commercially.

link: Gallery Title Injection on Github

This will be first hack I publish, I already have an idea for a totally pointless but fun challenge hack.