Ektron 9 - How to set Page Title (<html><head><title>...</title>...) - ektron

Noob question, but google is not giving me the goods:
How do you set the page title in a page in Ektron 9? You know: the text that goes into the title tag in the head of the html document.
In an Ektron 8 site I have used, there was a page title meta value that was used.
Does this work out-of-the-box?
If not, are there best practices?
What I have tried
Title of page is the "Content Title" not "Page Title"
New page widget does not have "page title" on alias screen as one pdf suggested
Googling "ektron page title" and variants did not throw up much.
Editing ektron page's folder properties did not show up anything.
Ektron settings "metadata definitions" does not have one for page title
Will keep you posted if I find the answer myself

Ektron does not create the definitions for Title, Description, Keywords or other SEO-related metadata out of the box (when you set up a min site, as is standard).
The site manager / developer defines those. How you set that on the page depends on your implementation and Ektron version.
For example, most 8.0 (and prior) sites will use the CMS:Metadata control in the of the master page (or page, if no master). The control accepts one dynamic parameter, so I used to place three controls, one for content (dynamic param = id), for forms (dynamic param = ekfrm), and for PageBuilder (dynamic param = pageid).
It's more common now (versions 8.5+) to see developers retrieving the metadata from the content (whether html / smart form, html form, or pagebuilder) using the ContentManager API method GetItem. This method accepts two params - the first is the ID of the item you want to retrieve, the second is boolean and, when set to true, will tell the API to retrieve metadata values. Once you have the values, you define the output.
Either method will work in versions 8.5+. The latter gives you more control.

Using Ektron 9 SP2.
We have a single line in the master page:
We use the DefaultContentID of the PageBuilder wireframe that is the front page. The other aspx templates just get the metadata of the HTML content item - all of our non-pagebuilder pages have a content block, then a bunch of smartform data.

Related

Get blog post custom field in template head - Sitefinity

I need to set several meta tag values in my page head to values set in blog post custom fields.
How do I access the blog item viewmodel from the head?
I've created a separate MVC view snippet for my custom head and referenced it in my template's layout, that much works.
Tried
I grab some of the same custom field values inside my blog template via references like Model.Item.Fields.MyFieldName.Fields.Title.
Adding this same line to the head template throws a
System.Web.HttpCompileException with little useful information attached. I somewhat expected this, as I suspect that viewmodel for the blog post only exists in the context of the blog widget.
Ends up that I need to rebuild after every change to the head cshtml file or I get this error. Seeing as this is about a four-minute process with Sitefinity (15 seconds to build, 3:45 to do whatever Sitefinity does for about four minutes), this is a gruelingly horrid thing to have to do.
However the Model is null at this level.
Also tried
Per the ever-helpful and highly knowledgeable #Veselin Vasilev, I looked into passing the data up via MetaDataFields. I didn't see these options in my admin section for the widget. To clarify, I'm using the built-in "Blog posts" widget with a customized view file.
But if it's possible to do this, it gives me hope that there's a way to pass more data up, even if it's going to take some work.
EDIT: Sitefinity v.10.2 and above:
There is an easier way to achieve what you are trying - in Page edit mode, in the Blog Posts widget click Edit and then Advanced. Then you should see a MetaDataFields button. Click it and you should see several meta data related fields.
In the MetaTitle field put the name of your custom field and save.
Also, from the docs:
If you leave MetaTitle field empty, Sitefinity CMS adds takes its value from the Title field of the static content item or from the identifier field of a dynamic content item. Otherwise, the tag is populated with the contents of the field that you have entered in MetaTitle field.
More details here:
https://docs.sitefinity.com/configure-meta-title-and-meta-description-on-widget-level
Sitefinity 10.1 and below:
Check this article
Basically, in your view you get a reference to the Page object and then update its Header with the meta data you need.

Sitefinity widgets not showing on News Detail page

Inherited a Sitefinity website. There's a news list page, which I discovered is reused by the news detail pages to display content. If I update the list page, the changes are reflected on the detail pages.
Sometimes.
I have a content block that contains a "header" text - updating this in the list page is replicated across the details pages. Adding a javascript widget to the page to inject some custom javascript replicates across the details pages as well.
Adding a new content block or css widget does not replicate across the details pages.
Is there some rhyme or reason to this behavior that I'm missing?
My specifics:
I've successfully created widgets in the MVC several times now. I essentially need to add a new widget to just the news pages. Which seemed simple enough until I discovered that news pages are not individually created pages like... well, pages... but instead are just a content piece that is dynamically inserted in the news widget on the "parent" listing page. At least as far as I can tell that's how it appears to be working.
Adding my widget to the page didn't work, as I explained above. I then tried recreating it in the page itself using javascript, content block, and css widgets, at which time I discovered that the javascript is the only one making it to the details pages. I imagine this has to do with the way javascript widgets actually make it to the page - their placement is selected in advanced options, rather than simply appearing inline.
Sitefinity widgets go beyond presentation, and actually control routing.
As such content widgets (baseline or custom) have two 'modes' that they operate in: list and detail. Slugs for details are automatically generated in the following format.
/News
/News/{News-item-slug}
Of course, a list and a detail should look very different. To accommodate that, the widgets have two separate configurable templates.
So, add your custom html and javascript to the appropriate template to have it only apply in a given mode.

Piranha CMS customisation

A few questions on customisation with Piranha CMS.
Is there a way to create additional custom site-wide items similar to those from the site helper? http://piranhacms.org/docs/api-reference/site-helper
e.g. to be able to set a phone number used throughout the site but still editable in the settings section of the manager.
Is is possible to create additional custom items for a page, e.g. page subtitle, and for those to appear in the Information section of page editing? Creating a region for say a page subtitle seems overkill.
Is it possible to create a custom page type with a region that is a collection of HtmlRegions or similar? e.g. for the purpose of managing a set of FAQs or similar enumerated content?
Is is possible to define custom settings properties for a page type?
Yes, you can add regions to your site in the same way as with page types under Settings > Sites. You then add content for them under Content > Pages > Edit Site.
You can add simple text properties on the page type. They will be shown as single line text inputs under Properties when editing the page.
No native support, however the region body can be anything that can be serialized to JSON so you have to handle this in the edit view for your region.
There is no support for injecting fields into the page settings, however if it's important you can override the whole edit view for pages and do anything you like by placing a copy of the view in the manager area in your local project. You can find the views in the github repo in the 2.2.5 branch.
Regards
HÃ¥kan

Sitefinity: How to set page title based-on the content item being viewed?

I have a page in Sitefinity 7 and its entire purpose is to show the detailed view of a custom content item.
So I've dragged-on a widget to the page, selected that it only shows one particular item only, without selecting which, because it should be whatever one was chosen from another page which caused them to navigate here.
One not-selected content item.
The page with the list control navigates to the detailed page.
But the page title is the same no-matter which is selected. I want the page title to be one of the content item's fields. How can I get the page title to be based-on the item we're viewing?
Edit the Awards widget on your details page and then go to the Advanced settings, then in the MetaTitle field enter the field name of your module you'd like to use, so in most cases "Title", then in the PageTitleMode field, you can enter one of a few options, Append, Replace or DoNotSet. Documentation on those options is here. You can also utilize the MetaKeywordsField and MetaDecriptionField by also mapping those to a new "SEO Keywords" or "SEO Description" long text field on your module for instance. Documentation on that is here.
The screenshot is from Sitefinity 6.3 but it should be the same.

Setting template property from a content page (sitefinity 4.4)

the site that I'm working at is designed in a such way that CSS class is set for the tag on all the pages and the css classes used are different for all pages. Each page has common elements such as a header, a footer and a nav bar. I'd like to set up a single page template and include all common elements there but the body tag stands in the way. Is there a way to control a template from a content page? I know I can specify a code behind for content pages but i can't rely on content authors to enter it correctly each time they add a page. My current thinking is to set up multiple page template, one for each css class that is referenced in the body tag and put the common page elements into user controls. This is less than ideal because I will end up with lots of mostly identical templates and my user controls would not be editable easily. I guess I would have to use shared content items and such making the content authors hunt all over the site. I would have been much simpler to update the common header in a single page template.
Can someone please suggest a way?
I submitted a reply in the Sitefinity forums where you originally posted this, but just in case you check here first I'll ask the same question: how is the css class for body determined?
if it can be done programmatically you can use the code-behind of the Master Page for the template to set it so that it's handled automatically.
If this won't work, tell me more about how the css class is assigned and I will try to come up with an alternative.
hope this is helpful!