-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make setting the page title format accessible to site administrators #3401
Make setting the page title format accessible to site administrators #3401
Conversation
…zor views and also when adding meta tags from code.
Ok so I assume I need to use RenderAsync method of the ILiquidTemplateManager - can anyone tell me how in my shape I would go about getting the templatecontext? |
@scleaver Like the idea of a pagetitle shape.
If I could have a PageTitle to satisfy most normal requirements then override with Blog-PageTitle it would be great Re: TemplateContext |
Actually Dean that is great idea!! Often your homepage is a different format to other areas of the site so a template that can vary would be amazing. This might be a bit beyond me though - would it be fairly straight forward to implement? |
Sweet. Yeah they always want something different for the homepage. I reckon if you have a look in OC.Contents.Shapes and do it with an IShapeTableProvider it should be pretty straightforward to do your work in OnProcessing, and describe the alternates in the OnDisplaying . You might have to provide a PageTitle.Summary view that does nothing to stop it getting overwritten by a ContentItem when it's contained in a BagPart and a PageTitle.Detail view that renders for the main CI. |
@deanmarcussen so you would still get the default setting from site settings but have also the ability to override it? Also I have tried new TemplateContext() but it didn't seem to process the liquid. Would I still do this in the display management module? |
I don't think I can do this in the display management module because I would have to make it referene the content management modules. |
@scleaver Your original plan was to make default setting available to administrators - so probably a site admin knows how to change settings, but might not know (or is a dev job!) how to build templates and alternates, so I'm thinking with that reasoning probably helpful to have a site setting - IMHO Think you can use IShapeTableProvider in DisplayManagement - it's described in DisplayManagement.Descriptors so intended to be used from there. Couldn't say about the new TemplateContext() - it may need a ContentItem set.. something like
is enough to get it going in a Driver Here's a very short version of a shapetableprovider I used in a theme (with Razr), if it helps at all
Rendered with
I see that DisplayManagement doesn't actually hold any Razor views, so maybe @sebastienros could chip in with some feedback on best place (and if he thinks this even a good idea to make it templated!) |
var htmlContentBuilder = new HtmlContentBuilder(); | ||
|
||
// Need to parse the title format somehow | ||
//var templateContext = new TemplateContext(); |
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.
Do you need help with that?
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.
@sebastienros - I am little stuck on this PR. I will have a look at in the next day and reach out for help.
Merge upstream changes
Pull OC dev into my fork
Bring up to date with latest dev branch. |
This is needed for #3214 |
I completed this PR with the missing code |
Can someone check why it doesn't work? |
Just forked the branch, it fails on setup because it resolves the I will fix it. |
There is still a race condition in |
That's ok now for unit tests. I didn't keep the trace when it was failing in Maybe here we would need a lock on a static object as we already did in another place and where we saw that Lucene using some global dictionary is not thread safe, but after more investigations. |
Just to say that it has been fixed |
Currently seeking feedback on my approach to allowing page title format to be moved from the theme layout level to be able to be set by site administrators. This is in response to issue #3400.
Approach
The code is currently not ready for merge but I would like comment on my approach here and see whether people agree. Here it is:
Questions I have
Please supply your feedback.