I am not that skilled with Umbraco and know very little about the api's. I am using ditto to get a page title set on the document types of a page. I want to dynamically set the title on a partial view or in the controller but can't seem to set the value of the title.
Currently I am trying this:
LocationPageModel locationPage = Model.Content.As<LocationPageModel>();
locationPage.Seo.SeoTitle = "Page Title to go here";
But when I call this on the Master page the SeoTitle is blank. Is there another way to set the SeoTitle without permanently updating the Umbraco databse? Or maybe just updating the current cache to display the change?
Thank you for your reply. Like I said in my post, I don't want to update the database, I just want to update the cache for that page to update the page title.
So I guess there are no other options for achieving what I want to do?
Setting property value when using ditto
Good day,
I am not that skilled with Umbraco and know very little about the api's. I am using ditto to get a page title set on the document types of a page. I want to dynamically set the title on a partial view or in the controller but can't seem to set the value of the title.
Currently I am trying this:
But when I call this on the Master page the SeoTitle is blank. Is there another way to set the SeoTitle without permanently updating the Umbraco databse? Or maybe just updating the current cache to display the change?
Any help would be appreciated.
Hi Tiaan
For changing Umbraco data you have to use Umbraco Services - https://our.umbraco.org/documentation/reference/management/services/
They are changing database values and updating the cache.
You can't just change view model and update the database with this code:
Thanks,
Alex
Hi Alex,
Thank you for your reply. Like I said in my post, I don't want to update the database, I just want to update the cache for that page to update the page title.
So I guess there are no other options for achieving what I want to do?
Tiaan, but you can't update the cache with data that is not the same as in the database, it's not an option.
Hi Tiaan
Did you find a solution? Share please with our community.
Alex
Tiaan, you can use some MVC way of passing data - https://www.codeproject.com/Articles/576514/AplusBeginner-splusTutorialplusonplusVariousplus
is working on a reply...