How to translate and rewrite articles using OpenAI GPT while keeping HTML markup intact – CyberSEO Pro

Estimated read time 3 min read

Did you know that the CyberSEO Pro plugin for WordPress can translate imported articles into different languages and rewrite their content using OpenAI GPT models while preserving the original HTML markup? This includes headings, lists, tables, images and embedded media content.

CyberSEO Pro supports three third party services for automatic article translation: Google Translate, Yandex Translate and DeepL. These services can translate an imported article into almost any language while preserving its HTML structure. The catch? These services are not free and require a subscription to use the API.

However, if you already have an OpenAI API key that you use for creating and rewriting articles with CyberSEO Pro, why bother paying extra for other services? Your existing OpenAI API key is more than enough to use the power of GPT to translate your content into a variety of foreign languages.

This task will be solved by a properly composed OpenAI GPT article assignment in the AI article generation tab of your feed’s settings. All you need to preserve the HTML markup of the original article is the phrase “return the result in HTML format“, which should be added at the end of your prompt. Accordingly, your assignment to translate the imported article into German, should look like this:

Translate the below article into German and return the result in HTML format:

And if you want to rewrite the article without translating it, use the following assignment:

Rewrite the below article in an informative style and return the result in HTML format:

Yes, it’s that easy! But keep in mind that GPT-3.5 models may not always do the job perfectly, especially when it comes to rewriting. On the other hand, the GPT-4 model excels at this task. Also be aware that OpenAI GPT will translate your entire HTML document, so the combined token count of the original text and the generated result should not exceed OpenAI’s text size limits, so set the value of the Max tokens field to half of the maximum allowed limit for your chosen GPT model.

Note that you cannot use the %post_content_notags% post template shortcode in this case. This shortcode removes all HTML tags from the original article and reduces its size in an attempt to fit within the token limit of the GPT model used. But in the case above, we want to keep the original HTML markup, so we need to use the more “weighty” %post_content% shortcode.

You May Also Like

More From Author

+ There are no comments

Add yours