npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hook-webflow

v1.0.0

Published

Please watch this video to get a quick overview of the integration hooks and how to use them. [Watch it on Loom](https://www.loom.com/share/89afdc3332644485809ab775a06d7732)

Downloads

4

Readme

Tutorial Video

Please watch this video to get a quick overview of the integration hooks and how to use them. Watch it on Loom

integration-hooks for Weglot

Script to automatically inject hreflang tags and snippets into all pages into your Webflow or Squarespace website

Disclaimer

This script automatically edit your website, please use it at your own risk. We encourage you to read the code.

Here is a summary of what it's doing;

Squarespace

We connect to your git's Squarespace with username and password and add a commit named "WEGLOT - Add hreflang tags". This commit add script and hreflang tags to configure Weglot properly into the site.region file.

Delete this commit to rollback this hook.

Webflow

We use your cookie config to send some requests to your Webflow editor:

  • We add one custom field for each translated language to all collections in order to store translated slugs.
  • We fill added custom fields to all items from all collections with the right translated slug.
  • We add script and hreflang tags to all custom head pages with right dynamic slugs.

Requirements

node >=10

Setup

  1. Clone repo git clone https://github.com/weglot/integration-hooks.git

  2. Install dependencies yarn or npm i

  3. Fill specific options from your platform:

Webflow (to be set in webflow/config.js)

  • apiKey: Weglot API Key from your Weglot dashboard
  • 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) cookies
  • projectName: 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 as my-first-project-a898b8
  • overwrite: default to false
    • true, we replace all content in all custom head
    • false we try to replace only existing Weglot tag with new one. If we can't find one we append Weglot tag to current custom head

Squarespace (to be set in squarespace/config.js)

  • apiKey: Weglot API Key from your Weglot dashboard
  • originalHost: your public website URL (eg. https://www.example.com)
  • translatedHost: your public website URL with LANG_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'])
  • user: Squarespace admin email
  • password: Squarespace admin password
  • projectName: 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

Run

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

Troubleshooting

Webflow

I broke all my custom head tags!

Go to the Settings tab on Webflow design editor then Backups and choose an old published version of your website to restore it. More information on Webflow documentation