Article alternate version
Sirius allows you to create alternate versions of an article depending on the language. In order to propose to your audience the most appropriate version. Sirius gives you keys to implement localized version, it's in your hands!
Create alternate version
Assuming that your article has a published (public) alternative version, this one can be linked very easily to Sirius.
Only one step is necessary, use the createOrUpdateArticleAlternateVersion
mutation from the GraphQL API,
Three parameters are mandatory:
articleId
– the target article IDurl
– the URL to its alternative version (it must start withhttp(s)://
)languageCode
– the language code in ISO 639-1
For instance,
- I would like to associate English version to my French article:
mutation {createOrUpdateArticleAlternateVersion(input: {articleId: "bG9jYWw6QXJ0aWNsZToxMg"url: "https://newspaper.com/path/to/article.html"languageCode: "en"}) {idurllanguageCode}}
- To update alternate version URL:
mutation {createOrUpdateArticleAlternateVersion(input: {articleId: "bG9jYWw6QXJ0aWNsZToxMg"url: "https://newspaper.com/another/path/to/article.html"languageCode: "en"}) {idurllanguageCode}}
- Then, to delete use
deleteArticleAlternateVersion
mutation:
mutation {deleteArticleAlternateVersion(input: { id: "bG9jYWw6QXJ0aWNsZUFsdGVybmF0ZVZlcnNpb246MQ" }) {id}}
Constraints
- Sirius does not permit defining several alternate versions with the same language
- Alternate version language cannot be equal to Sirius default language
- If this occurs, an error will be returned:
{"errors": [{"message": "Article alternate version’s language same as article’s default language"}]}
Distribute variations
Now, you have several variations of your articles, you want to propose the most appropriate version to your users, according to their language.
Most of them will use a search engine to point your articles, probably Google. To this end, you need to include versions into your HTML, HTTP headers or even sitemap.
Help them find the best variation for your audience, follow the guide!
Query all alternate version from article:
Edit this page on GitHubquery {node(id: "bG9jYWw6QXJ0aWNsZToxMg") {... on Article {alternateVersions {idlanguageCodeurl}}}}