How to exclude URLs/blocks/words from translation?
In this article, you'll find how to exclude a specific block or paragraph from being translated in your website.
1. Exclude URLs
Using Weglot, you can exclude some pages from the translation. These pages won't be translated at all and the button will also not display.
Then add the relative URL of the page that you want to exclude.
For example, if your page is www.mywebsite.com/page1/, then only add its relative URL: /page1/
The URL exclusion can work with different options that you can select by clicking on "Add Rule":
- Contain: It will exclude all the pages that have their slug containing the input
- End with: It will exclude all the pages that have their slug ending with the input
- Start with: This option will exclude all the pages that have their slug starting with the input
- Is exactly: It will exclude the page that has it slug identical to the input
- Match regex: It will exclude the page matching the regex input
If you want to exclude more URLs, click on "Add Rule" and repeat the steps.
Note: that Weglot doesn't automatically remove the translations related to the excluded pages. Once the pages are excluded, you'll need to manually delete the translations related to these pages. See: How to definitely remove a translation?
2. Exclude blocks
There, you can paste the right CSS selector of the block. You can find the CSS selector by right-clicking on the block > Inspect Element:
In this example, you have the choice to exclude either the ID (menu-menu-1) or the CLASS (nav or navbar-nav). No matter the name of the selector, if it's an ID, you must add a sharp "#" before and if it's a CLASS, you must add a dot "." before.
You can add as many classes and id as you want in this field. Then, the content won't be translated whatever the language is.
Note that Weglot doesn't automatically remove the translations related to the excluded blocks. Once the blocks are excluded, you'll need to manually delete the translations related to these blocks. See: How to definitely remove a translation?
If you are using WordPress or Shopify, you can also exclude content by block and/or URLs directly into your WordPress/Shopify admin:
- On WordPress, you can go to your Dashboard > Weglot :
- On Shopify, you can go to your Dashboard > Apps > Weglot :
3. Translations Rules
Translation rules do not exclude the content from being translated. It only forces some words to be translated a certain way on your website.
In this section, you can indicate if you want a word/expression to be translated or translated in a custom way. The rules will be applied to all new translations but won't change the existing translations. Please note there is a three-word max limitation per rule
Then click on "Save" and it's done