Closed pauldbentley closed 5 years ago
At the moment there's both Title
and NavigationTitle
, do you think we need a third title field on the base entity?
Best regards
Yes I think the browser title would have different content to Title
and NavigationTitle
.
So in the example of your homepage http://piranhacms.org/ - you have:
NavigationTitle = Home Title = By developers - for developers BrowserTitle = Piranha CMS - Open Source, Cross Platform Asp.NET Core CMS
Added a pull request (#738) for this issue, but I'm running in some problems with the commit. Coverall is throwing an "coveralls.exe 422 Couldn't find a repository matching this job." exception. How do I fix this?
I see everyone's point in adding an extra field, however in most cases just this extra field wouldn't do much difference. For example if we look at the start page of http://piranhacms.org, this page type has a HeroRegion with the following fields:
public class Hero
{
[Field(Options = FieldOption.HalfWidth)]
public StringField Subtitle { get; set; }
[Field(Title = "Primary Image", Options = FieldOption.HalfWidth)]
public ImageField PrimaryImage { get; set; }
[Field]
public HtmlField Ingress { get; set; }
}
These fields together is used to make up the header you're referring to. Just adding another title wouldn't solve anything in this (and probably many cases). Also, adding fields to the base entity only really applies if the fields are needed when you're loading an info model like PageInfo
or PostInfo
, i.e when you want to make a simpler query for building sitemaps, lists or things like that. The field we're talking about here will probably never be used other than when rendering the actual page and the entire model is loaded anyway.
Now if you have extra fields that you find you need in all of your pages there's nothing stopping your from creating a base class in your project that adds these fields:
public abstract class MyBasePage<T> : Page<T> where T : MyBasePage<T>
{
[Region(Title = "Extra fields")]
public MyExtraFields ExtraFields { get; set; }
}
public class MyExtraFields
{
[Field(Title = "Browser title")]
public StringField BrowserTitle { get; set; }
[Field]
public TextField Description { get; set; }
}
Does this make sense? Do you have anything to add @filipjansson?
/Håkan
Hi @tidyui - thanks for all the thought and explanation put into this.
So as you suggest - I could use the Title
property and place this in the <title></title>
element, then have a Hero region as per your example on a base class. This will meet the requirements.
Is it possible to have a separate field for the browser title - i.e. the value in the