CMS tracking

Is there any way to catch in HubSpot CMS when a page is published, deleted, or updated? Blog post published/updated/deleted?

The only way I can think of is through the content audit API.

How do you mean “catch”? In realtime? With the API, maybe polling it every so often is enough?

Hi there! Yes, this is what I was looking for: a way to globally track whether changes were made or the status of a page/blog was updated, and based on those changes, trigger further actions and send data to an external source. Thanks for the answer

Hey @YLivenskiy,

API as @MichaelMa is the safest and best way if it’s for external stats.

In case you’d like to create something like a info banner which will be displayed if the page is not published or change something on the page/code depending on the status, you can try following HubLs

{{ content.currentState }}

{{ content.currentlyPublished }} {# boolean #}
{{ content.isPublished }} {# boolean #}

Bundled with an if-statement it could look like this

{% if content.currentState == "PUBLISHED" %}
{# some content if the page is published #}
{% endif %}

or

{% if content.isPublished %}
{# some content if page is published #}
{% else %}
{# some content if page is not published #}
{% endif %}

p.s.:

You can see all page information if you add

{{ content|tojson }}

into the rich-text source-code or straight into a module/template

best,

Anton

Hi! Thanks for your answer. Really useful information :handshake: