Dynamic page title from SC

In a layout page I defined in the Template Data a variable called page_title:
image

On a content page using this layout, I defined the page_title in the properties:
image

However the page title is not updated and stays empty.

When using a static value, like below, the page title is properly set:
image

The server action I use is returning a value btw, without any errors. Why is this not working with dynamic data from the server action?

1 Like

Can @Teodor shine a light on this perhaps?

  1. Create a database table. Title and description are self explanatory. The pathname is used to filter the data.

  2. Create a server action. For the step, use a single query filtered on the PathName == URL.

  3. On the page, enter the Server Connect and choose the title and description.

Is there an advantage to doing it this way instead of with the JSON as you described here:
https://community.wappler.io/t/correct-title-and-meta-description-for-spa/9254

Using the JSON method will carry the title etc after the page is loaded (client-side rendering).

This method will carry the title as the page is loaded (server-side rendering)

To see the difference between the two, have a look at

THANK YOU Ben

1 Like

Hello!

I’m following step by step your tutorial but on the Layout Page I can’t select the Template Data,

Captura de pantalla 2023-08-15 a la(s) 16.55.07

I need to set the Page Propierties “Title” to dynamic value from “page_title” (value created from the Define Template Data)

Captura de pantalla 2023-08-15 a la(s) 16.57.13

It only shows me the output data from the “login_restrict” server workflow.
Captura de pantalla 2023-08-15 a la(s) 16.55.27