Comments (5)
@patricknelson - did you make any progress with this? I'd love to see some documentation/ examples around the extension hooks.
from silverstripe-googlesitemaps.
It depends on what you mean by "progress" @TamaEaston ->alterDataList(...)
hook where I ensure that you don't even list page types which have zero results for the current domain (since I have a custom implementation of a multi-domain website).
To clarify (now that you caused me to think about it a bit more) I think the core point to opening this issue was more to discuss if it made sense to:
- Eliminate just specifically
updateGoogleSitemapItems
, since now we have a newalterDataList
hook (which directly handles exactly the same task but more centrally and less repetitively). I think it makes sense to retain the other hook (updateGoogleSitemapItems
) as it still provides utility that is not precisely solved by just havingalterDataList
since those are two different lists with different contents. - Migrate the other hook
updateGoogleSitemaps
to being triggered on the rootGoogleSitemap
class to help simplify things. Currently you (unfortunately) have to setup yet another extension just to affect the sitemaps listed in the controller even though it is entirely sourced fromGoogleSitemap::inst()->getSitemaps()
-- why extend a controller to alter that list when it's sourced there? I understand it's only currently used in the controller, but extending two different objects when it otherwise would be easy to simply extendGoogleSitemaps
makes no sense. - Possibly refactor
GoogleSitemapExtension
toGoogleSitemapPageExtension
to better define it's use/purpose because if you do want to extendGoogleSitemap
you cannot use the most intuitive name as it's already taken by the aforementioned page extension. Confusing, I know...
For example, if you utilized all of the extension hooks (like I currently do):
/**
* IMPORTANT: Class name contains superfluous "Custom" word because "GoogleSitemapExtension" is
* already setup in the module itself (see #3 above).
*/
class GoogleSitemapCustomExtension extends Extension {
/**
* @param DataList $dataList
* @param string $class
*/
public function alterDataList(DataList &$dataList, $class) {
// alter $dataList as you see fit...
}
}
class GoogleSitemapControllerExtension extends Extension {
/**
* @param ArrayList $sitemaps
*/
public function updateGoogleSitemaps(ArrayList &$sitemaps) {
// ... modify the root sitemaps that can be output to the front-end.
}
/**
* @param ArrayList $items
* @param string $class
* @param int $page
*/
public function updateGoogleSitemapItems($items, $class, $page) {
// ... this doesn't make sense anymore due to alterDataList on the
// aptly named GoogleSitemapCustomExtension above...
}
}
from silverstripe-googlesitemaps.
@patricknelson - that is awesomeness above and beyond the call of duty. Thank you.
from silverstripe-googlesitemaps.
I like to be thorough!
from silverstripe-googlesitemaps.
Patches welcome!
from silverstripe-googlesitemaps.
Related Issues (20)
- Timeout on big lists of objects HOT 1
- GoogleSitemap::ping() cannot be piped through CWP egres proxy HOT 4
- Including PDFs into the sitemap HOT 3
- Bug: empty sitemap on SS 4.4.1 HOT 1
- SS4.4.3 : XML Parsing Error: XML or text declaration not at start of entity HOT 7
- Google Search Console can not read sitemap.xml HOT 2
- First line empty, leads to xml Error HOT 3
- Sitemaps empty for DataObjects HOT 3
- google_notification_enabled config no longer does anything
- canIncludeInGoogleSitemap returns array when passed through override
- Changelog out of date HOT 1
- only has_one and has_many images are included not many_many HOT 2
- MINOR: simplify the way images are added to remove from sitetree and simplify code. HOT 3
- Does Image in a xml-sitemap provide value without Title? HOT 1
- SilverStripe 4.x Googlesitemap - sitemap.xml Image did not exist HOT 2
- Add caching to optimize calls to ->canIncludeInGoogleSitemap() HOT 1
- add interface for dataobjects HOT 1
- Calling sitemap/$class/$pageId with string as $pageId triggers 500 error
- Pinging updates to Bing no longer works HOT 2
- New tag for SS5 compat HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-googlesitemaps.