core
core copied to clipboard
Site Variable does not render in a headless application / redering page using API
As reported in: https://dotcms.zendesk.com/agent/tickets/105638 v5.3.8.5LTS Tested in v5.3.8.5LTS
In a headless application, when i calling the api/v1/page/render/{mypage} service, the host_variable does not render.
There is a workaround: adding the code to your VTL: #parse("LIVE/${host.identifier}.site")
To Reproduce Steps to reproduce the behavior:
- Create a page
- Add a reference to the site variable (e.g.
<p>$host_variable.{var}</p>) - Render the page using the API
- The code does not render - it just displays the code
Screenshots

In order to test you can create a container and a couple site vars, such as this
$title
on container: $host_variable.onevar <br/>
$host_variable.secondvar
You should see the vars translated to the real values on the site vars
Fixed, tested on release22.07 // Docker // FF

We need some work here, we need to create a curl test for this specific case.
@jdotcms Here.
PR for postman tests left for master/next-release: https://github.com/dotCMS/core/pull/22653
Since the tests was done in master, moving this to next release so @bryanboza can check it and pass is there.
Now we have the curl test implemented and running, but in this implementation we are using the host word instead a site wich is not good because we are using both to the same thing.
After a discussion with @wezell we need to change the names of the new endpoints to and replace host by site at the endpoints level
Here the list:
- saveHostVariable
- getHostVariables
Done: PR
https://github.com/dotCMS/core/pull/22878
Merged.
Fixed, feedback applied. Tested on release-22.09 // Docker // FF
Excluding from LTS releases as there is a viable workaround and the issue has been low impact