Call to Action¶
The Call to Action (CTA) feature adds a single configurable action button to content. Editors give the button a label, a target link, a type (for example a regular link or a mail link) and decide whether it opens in a new window. The CTA data is exposed in the REST serialization of the content so the frontend can render the button.
Overview¶
A CTA consists of:
cta_label – the visible button text.
cta_type – the kind of action, drawn from a configurable vocabulary (
Link/Mailby default).cta_href – the target link. Internal links stored as
resolveuid/...are resolved to absolute URLs in the serialized output.cta_new_window – whether the link should open in a new browser window/tab.
Label and link are coupled: a CTA must have either both a label and a link, or neither. A label without a link (or a link without a label) is rejected on save.
REST API¶
The CTA fields appear directly in the serialized content. Render the button only when both cta_label and cta_href are present.
GET /Plone/my-page HTTP/1.1
Host: localhost:8080
Accept: application/json
{
"@id": "http://localhost:8080/Plone/my-page",
"cta_label": "Contact us",
"cta_type": {
"title": "Mail",
"token": "mail"
},
"cta_href": "http://localhost:8080/Plone/contact-form",
"cta_new_window": true
}
The fields:
cta_label– the button text, ornullwhen unset.cta_type– the selected type as a token/title object, ornull. The default vocabulary offerslinkandmail.cta_href– the resolved absolute target URL, ornull. Internalresolveuidreferences are converted to absolute URLs before serialization.cta_new_window– boolean; render the link withtarget="_blank"whentrue.
const response = await fetch('/Plone/my-page', {
headers: { 'Accept': 'application/json' }
});
const page = await response.json();
if (page.cta_label && page.cta_href) {
const target = page.cta_new_window ? '_blank' : '_self';
console.log(page.cta_label, page.cta_href, page.cta_type?.token, target);
}
Configuration¶
The available CTA types come from a registry record:
wcs.backend.content.cta.types
A list of Title:value entries (title and value separated by a colon) that populate the cta_type vocabulary. The default set is Link:link and Mail:mail. Add entries here to offer editors additional action types; the chosen value is what appears as the token in the serialized cta_type.