-
Notifications
You must be signed in to change notification settings - Fork 27
Create XML Sitemap #132
Comments
the xml sitemap sounds very useful indeed. for a html sitemap, i am less sure - maybe we can just provide the thing that walks the phpcr tree in a way that it can be reused by somebody wanting to build the html sitemap. how to actually do that is probably very site specific (what to include / exclude in the sitemap, for example). |
In this case we would want to add sitemap priority and a boolean exclude from sitemap to the seo metadata. For an html sitemap I think that knp menu bundle is a better choice for the task (in other words I would advocate for sticking to just XML since that is directly relevant to SEO but a sitemap page on your site is less so and is already handled by knp menu). |
I would also consider perhaps just providing instructions to users as to possible sitemap solutions as opposed to trying to implement one. The reason I say that is that there are 2 bundles out there already that provide sitemap function that I can think of SonataSeo and PrestaSitemap. SonataSeo is somewhat limited because it is based on sql queries (unless they have updated it). This makes it a poor fit for cmf documents because writing a raw sql query that generates the url for a cmf document is difficult or not plausible. PrestaSitemap is the bundle we chose because it is more flexibile with the ways you can populate the sitemap and provides the concept of "sections" which we use to implement multiple sitemaps for different websites in a multi-host solution. This bundle could definitely provide the standardized ability to store sitemap related information for dynamic objects like sitemap priority and whether an object should be excluded from the sitemap. |
Correction sonata admin is capable of generating sitemaps via services although it is not documented https://github.com/sonata-project/SonataSeoBundle/blob/master/DependencyInjection/SonataSeoExtension.php#L100 |
Not only the admin bundle, the sonata-seo-bundle should provide some functions to show sitemaps |
while doing this, we could also look into https://support.google.com/webmasters/answer/2620865?hl=en and #166 to provide language alternatives in the xml sitemap. |
👍 Mit freundlichen Grüßen Maximilian Berghoff Maximilian Berghoff Mail: [email protected]
|
Just some more questions:
Can do that with extractors, but as @wouterj wanted to deprecate them, how to handle that else? From the technical point of view, i wanted to use the sitemap stuff from SeoBundle, but this one only provide an abstraction to query a doctrine. So i will do by looping through all routes and create xml by using |
Btw, using extractors will make no sense when looping through a list of routes. So we will need some mapping/configuration to get the information from the routes's content. |
Came to the conclusion, that it will be better to start with the content and create the url from it by the help of the url generator. So we will have the power to generate the alternate urls too, as i did it in #175. |
asking to explicitly register the routing.xml file and define it in there has the benefit that its more visible and one could customize the url - though that would be a bad idea with google. i think the provider idea makes most sense. there can be so different logics. maybe we need a visitor pattern or something? the visitor would be passed routes and metadata. then the metadata can be infered from the content of the route (e.g. a news does not change once its published, homepage updates often, ...) or from some manual data stored somewhere. |
Got one little performance issue in my head: |
its going to be slow either way i fear. i guess the thing to do is provide a command to optionally dump the sitemap to the fs. to take load off the db. but you can experiment with prefetching data - sometimes it helps. sometimes it also hurts more, so definitely try it first. and make it optional. |
@ElectricMaxxx did you start any work on this? if not i will probably tackle this soon. |
not jet just prepared the "many-function" for the alternate locale in the other PR. |
@wouterj i had a look into the KunstmannSitemapBundle (https://github.com/Kunstmaan/KunstmaanSitemapBundle), cause by the strong coupling to the orm we can't use the controller. Btw: there is no chance to hook into it. So the only think we could use would be the templates and the twig extensions. Enough for depending on that bundle? |
Unless the twig extension is very complex, -1 :) |
or try to refactor the kunstmaan bundle to the point where it can do |
oh, actually i am -1 now. looked at composer.json and they not only |
... and the twig extensions arn't that poverful as they seemed to be. there are more extensions to hide a node then displaying one :-) |
Conclusion what we planed in the comments above:
|
I think you're missing some things:
|
thanks @wouterj why the listener? would it be enough if somebody create its custom route and map it to the controller/action we provide? |
Yeah, but I don't like it to use routes to configure some feature. I use a listener for it most of the time |
solved by #196 |
As we have access to the routes inside the PHPCR and the cmf handles routes it would be easy to create a xml representation of their structure.
But i would not only suggest to create a xml Stitemap, even a html representation would be doable. Maybe could add a configuration value for a template to render beautyfull lists of Routes, maybe with some previews to the content.
The xml-generation could be done by
SonataSeoBundle
. The other thing need be done by us.The text was updated successfully, but these errors were encountered: