-
-
Notifications
You must be signed in to change notification settings - Fork 769
Priority-based IPageService for page metadata, head tags, and messages #6738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Moving this content to the right place. One additional consideration here is the long-standing behavior that modules have been using to override the title property of the default page object and how we handle this. This for example has been the suggested pathway for years. var dnnPage = (CDefault) this.Page;
dnnPage.Title = $"Register for {eventDetail.Name} | MyCompany";I assume that this process will break this behavior |
Yes, you are right this break actually this behavior. I can maybe include the value of the changed dnnPage.Title in the pageService in the PreRender of the page with a certain priority. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sachatrauwaen looking at this API structure this looks great. I'm curious with regards to the existing API's that would be replaced here.
- Can we get an accounting of all of them and get them updated with an [Obsolete] attribute
- Can we validate that all would use the same logic
|
@mitchelsellers with regards to the existing API's
The only API that exist is Skin.AddPageMessage.
I redirect all code outside of the Skin class to the new api
|
make PagePriority static use ToModuleMessageType in Default.cs
…nal method Modify existing code to use new api Mark MemebershipModule.OnUnverifiedUserSkinInit obsolete, not used in dnn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Let's switch from Obsolete to DnnDeprecated, but otherwise I think this is good.
So long as the method is unused, I think marking it obsolete is great. Thanks! |
new DnnDeprecated attribute Co-authored-by: Brian Dukes <[email protected]>
new DnnDeprecated attribute Co-authored-by: Brian Dukes <[email protected]>
new DnnDeprecated attribute Co-authored-by: Brian Dukes <[email protected]>
new DnnDeprecated attribute Co-authored-by: Brian Dukes <[email protected]>
Summary
Add a simple, priority-driven API for setting page title/description/keywords/canonical URL, injecting head tags and meta tags, and collecting user-visible messages. This formalizes page composition logic and decouples it from the rendering pipeline, supporting both the current WebForms pipeline and the new MVC pipeline.
Motivation
Scope
IPageServicePageMessage,PageMessageTypePageMetaPageTagPagePriorityProposed API
void SetTitle(string value, int priority = PagePriority.Default)void SetDescription(string value, int priority = PagePriority.Default)void SetKeyWords(string value, int priority = PagePriority.Default)void SetCanonicalLinkUrl(string value, int priority = PagePriority.Default)string GetTitle(),string GetDescription(),string GetKeyWords(),string GetCanonicalLinkUrl()void AddToHead(PageTag tagItem)List<PageTag> GetHeadTags()void AddMeta(PageMeta metaItem)List<PageMeta> GetMetaTags()void AddMessage(PageMessage messageItem)List<PageMessage> GetMessages()void Clear()PagePriority.Site = 10,PagePriority.Page = 20,PagePriority.Default = 100,PagePriority.Module = 200PageMessageType:Success,Warning,Error,InfoPageMessage:Heading,Message,MessageType,IconSrc,PriorityPageMeta:Name,Content,PriorityPageTag:Value,PriorityExample usage
Rendering contract
GetMetaTags()andGetHeadTags()in ascendingPriorityorder.GetMessages()in ascendingPriorityorder, with styling determined byPageMessageType.In default.aspx
Between the will skins and modules contributions to the pageservice executed with custom info like meta tags
Convenience extensions (
Library/Services/Pages/PageExtensions.cs)These helpers provide simpler overloads for common operations:
Example:
Fixes #6737