How to exclude from translation all pages except specific one(s)?
In this article, you'll find how to exclude every page from translation except specific ones.
Go to your Weglot Dashboard > Settings > Translation exclusions
There, you'll normally be able to add the pages you would like to exclude:
Then you can click on "Add Rule" and select "Match regex":
There's a way to say "exclude everything except..". This is possible with regular expressions (RegEx).
Little reminder: the Exclude URL section is working with relative URLs. For example, if your page is www.mywebsite.com/mypage/, then /mypage/ is the relative URL.
Tips for the Exclude URL section with regular expressions (RegEx)
- Exclude everything except a specific page using its relative URL: ^(?!/mypage/$).*
- Exclude everything except the landing page: ^(?!\/$).*
- Exclude everything except a few specific pages: ^(?!/$|/shop/$|/categorie-produit/$|/produit/$).*
- Exclude everything except everything that begins with /product/... ^(?!/product/).* (Meaning, without the "$")
If you're using WordPress, you can follow the same method and add the rules directly into your WordPress Dashboard > Weglot plugin > Exclude URL section.
If you're using Shopify, you can follow the same method and add the rules directly into your Shopify dashboard > Apps > Weglot Translate > Other options section > Exclude paths.