Script to automatically inject hreflang tags and snippets into all pages into your Webflow or Squarespace website
Before running this script, please be aware that any existing text/scripts inside your Webflow or Squarespace page headers will be overwritten.
node >=10
-
Clone repo
git clone https://github.com/weglot/integration-hooks.git
-
Install dependencies
yarn
ornpm i
-
Fill global options from
config.js
apiKey
: Weglot API Key from your dashboard setup
Only Squarespace:
originalHost
: your public website URL (eg. https://www.example.com)translatedHost
: your public website URL withLANG_CODE
instead of language code (eg. https://LANG_CODE.example.com)originalLanguage
: your original language (eg. 'en')languages
: array of your languages (eg. ['fr', 'de', 'es'])
- Fill specific options from your platform:
wflogin
/wfsession
: In your Webflow admin page, open Chrome devtools (right click "inspect") > Application tab > Cookies > webflow.com, get content from wflogin (eg. 10101894633456) and wfsession (long random strings) cookiesprojectName
: Slug from webflow admin. Go to webflow admin page > Design mode > get current URL and remove https://webflow.com/design/ first part, you should get something asmy-first-project-a898b8
user
: Squarespace admin emailpassword
: Squarespace admin passwordprojectName
: Slug from Squarespace admin. Go to Squarespace admin page and get first piece of current URL: https://GET-THIS.squarespace.com/config/... eg.lobster-bear-t9h1
When you are ready, run node squarespace/hook.js
or node webflow/hook.js
This script edit your website but it doesn't publish it if it's necessary, like on Webflow