How can I add a meta title and meta description per page

1
I'm trying to add a meta title and a meta description per page I'm creating. I.e. I'm adding a shop to my application and I want to give each shop I'm adding a different meta description and title. How can I achieve this through the modeler?
asked
3 answers
3

I created a newer version of the Titler-widget, which is currently waiting for approval: Dynamic HTML Title. This should work for newer Mendix versions and works in the same way: you create a microflow which provides an HTML title for that page, which can be contextable: placing the widget inside a dataview enables the use of that object as parameter in the microflow.

Mendix always uses the same base file, index.html, in which the pages are loaded. The HTML title will be overwritten by Mendix first and then by this widget. For search engines, I would assume that only the title of the index.html file is read and the titles generated by Mendix or this widget are neglected, but I'm not an expert on Search Engine Optimization (SEO).

answered
1

Something like the following widget code, for an attribute str_windowTitle perhaps?

.
.
.
_updateRendering:function(){
        if(this._contextObj!=null){
            var str_title=this._contextObj.get(this.str_windowTitle);
            var myVar = setInterval(function (){$(document).prop('title', str_title);}, 500);
        }else{
        }
}
.
.
.

Question: how come I need to use setInterval(), near immediate execution results in no window title change.

answered
0

Maybe, you can use the "Titler" widget from the Appstore; but it is broken for newer Mx versions. When downloaded in your project, you can place the "Titler dynamic" widget within the dataview that contains the main content on the page you want to provide a dynamic title. Edit this widget and click on select microflow, create new. In this newly created microflow you can return for example $Entity/name as string, add additional text etc. This will be then shown as title of the page.

answered