This article is for Account Owners and Project Managers using the Global Delivery Network.
The Advanced GDN Rule editor is designed for developers who have in-depth knowledge of your source code, site design, and the Global Delivery Network. Changes made using this tool can break functions of your translated sites, and in some cases prevent the translated sites from functioning in entirety. We recommend that you instead markup your source code using our GDN integration tags or configuration rules. If there are cases where this is not possible, contact your Customer Success Manager to discuss if this tool is right for you.
Rewrites allow you to alter the contents of a file or page, either before or after it has been parsed by the GDN. Similar to find and replace, you must specify a string or regex pattern to find and a string to replace it with.
Rewrites can be applied either before it has been parsed by the GDN (pre_replace) or after translations have been applied (replace).
A content swap is a form of a rewrite that can be done without access to advanced rules.
Rewrites can be applied at the following 4 points:
Replaces matched content in all file types BEFORE it is parsed by the GDN. This rewrite should be used if you want to change how content appears to the GDN.
For example, you have language-specific content that you want translated instead of the existing source content. A pre_replace rewrite will change the content before it is parsed by the GDN, effectively stopping the original source content from being ingested at all.
Replaces matched content in all file types AFTER translations have been applied by the GDN. This rewrite should be used if you want to change how content appears to the end-user, after the GDN has completed parsing and translations.
For example, you have added a class or comment for parsing purposes that you do not want displayed to the end user. Once translations have been complete, you can use a rewrite to remove these lines. In contrast, using a pre-replace would mean that the GDN would not see these classes/comments and revert to its default behavior.
This rule ensures API requests are sent in the language of the API. This allows you to display translated strings on your website while ensuring any API requests match the language of your source code.
Poorly or incorrectly written rewrites can have adverse effects on your GDN sites. Issues can include incorrect parsing of content (filling authorization queue with wrong strings), broken functionality or performance loss. It is ALWAYS recommended that you test your GDN rewrites on a staging site first.
Testing for rewrites should always be conducted on a non-production environment first. When modifying an existing rewrite, you should always create a copy of it first. You can then disable the first rewrite to test your new rule.
Rewrites are NOT backed up and cannot be restored to a previous version.
Rewrites can be limited to a single domain by using the Domain dropdown option within the advanced rules interface. After testing, the rewrite can be applied to a production environment by changing the domain.
Rewrites can also be limited to specific URIs by specifying 'uri:' in the Rewrite Condition field. For example, if you only want the rewrite to apply to blog pages, you can use the following condition:
When using a regex pattern for the rewrite search, make sure you tick the 'Is regex' option. Please note that poorly written regex patterns can have a negative performance impact on your localized sites.