-
Notifications
You must be signed in to change notification settings - Fork 482
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
DOCUMENT provider refactoring #238
Comments
We probably should add you to the repo since you understand what's going on. We need to support both ways of creating the document but your implementation is solid. We should probably megre your changes. There are a couple of things we need to sync up on |
+1 on adding @alexpods with full access to repo. The only thing I wonder about with this particular issue is whether there will be any perf hit for using the parse 5 HTML object as opposed to our own implementation. I do think we should go with Alex's suggestion regardless to see what happens. Btw, this touches on the meta tag service that is in another issue. We should all brainstorm on how we want this to work because it is going to come up with many people that use Universal. My initial thought is that perhaps we should have a metaTagService/seoService/headService/whatever that is part of Angular Universal which is used to set title, keywords, facebook title, rel href tags, etc., etc. In addition to the Universal service, we should have (ideally) a declarative way of specifying these values. IMO, meta tags change depending on 2 factors: route and current state. As such, perhaps we have something that is part of the RouteConfig decorator and/or some sort of state decorator (I can show you some stuff I am doing on this in my current app). |
@alexpods can you open a pull-request? |
@gdi2290 Yes, sure. Right now I'm busy, but later today PR will be done (right now 11:30 AM in Moscow). @jeffwhelpley My benchmark shows that there's no performance regression (at least with a small app). But we definitely should optimize performance as much as we can. And we should start with reusing the same services for different requests. For example reusing already created ProtoViews can give us big boost of performance. Maybe we should move these services to |
+1 - Yes please do this. Need to be able to have pre-rendered dynamic title and meta tags |
+1 for headService. |
+1 - yes please |
closing this as everything has been merged other than head service |
any news regarding the head service? |
@justme1 it is on our ToDo list, but right behind two other high priority items that we need to get done first. If you or anyone else from the community wants to help out on this, let me know. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently provider for
DOCUMENT
requiresappComponentType
(see it here). It looks very strange to me, because we provideappComponentType
only on bootstrapping phase, not when we're creating an application. Also this provider creates mock document which makes it very difficult to implement services for changing document title, meta tags and so on. I think it would be much better if we created a real document there based on a real html.I've implemented this in
up
branch ofangular2-universal-starter
.The main points:
application
should be bound with a particularDOCUMENT_HTML
(see it here and here)DOCUMENT
creates a real document based on thisDOCUMENT_HTML
(see it here)parse5
serialization is used after bootstrapping (see it here).Pros
appComponentType
as an application provider.Title
becomes a trivial task. For example seeServerTitle
implementation here. In this case if we have someworkers
page like:then prerendered html will contain
<title>
tag with"Workers Page!!"
text. And I want to mention that<title>
tag is very important for search engines.What do you think about it?
The text was updated successfully, but these errors were encountered: