Skip to content

Instantly share code, notes, and snippets.

@jupitercow
jupitercow / squarespace-age-gate.js
Last active May 3, 2022
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.
View squarespace-age-gate.js
<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).
*/
@jupitercow
jupitercow / squarespace-age-gate-global.js
Last active Feb 12, 2017
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).
View squarespace-age-gate-global.js
<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]; }
View Add a Github Plugin to the WordPress.org Repository
# 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 ../