Skip to content

Instantly share code, notes, and snippets.

# Checkout the repository from .org (must use “https”!)
svn co https://plugins.svn.wordpress.org/sewn-in-xml-sitemap .
# Change directory to the trunk
cd trunk
# Clone the plugin files from Github
git clone git@github.com:jupitercow/sewn-in-xml-sitemap.git .
# Change back to parent directory
cd ../
@jupitercow
jupitercow / squarespace-age-gate-global.js
Last active February 12, 2017 20:17
Squarespace Age Gate. Add this code globally: Settings > Advanced > Code Injection. Your "Age Gate" page needs the slug of "age-gate", or you need to edit that in the code (2 places).
<script>
var cookies;
/**
* Returns the value of the cookie name.
* @param {string} name
* @returns {string}
*/
function readCookie(name,c,C,i){
if (cookies && cookies[name]) { return cookies[name]; }
@jupitercow
jupitercow / squarespace-age-gate.js
Last active November 17, 2022 19:40
Squarespace Age Gate. Add this code just to the Age Gate page. This is usually a "Cover Page" under Pages > Not Linked. Click the gear icon, go to Advanced tab in the popup, paste this code. This sets the cookie and handles the redirect back to the requested content.
<script>
/*
Squarespace Age Gate.
- Create a "Cover Page" under Pages > Not Linked.
- Click the gear icon, go to Advanced tab in the popup, paste this code.
- This sets the cookie and handles the redirect back to the requested content.
- On the age gate page, you have to create a button that has "#legal" as the link or href. It is what turns off the age gate.
- Elsewhere on the site, you can test for the cookie (legal), and if not set, rediret to the age gate Cover Page (example at the bottom).
*/