diff --git a/css/style.css b/css/style.css index 5dc4912..7250bd4 100644 --- a/css/style.css +++ b/css/style.css @@ -101,7 +101,6 @@ table.tablesorter thead tr .headerSortDown { table.tablesorter tbody td { color: #005A92; padding: 4px; - vertical-align: top; } table.tablesorter tbody tr{ @@ -124,6 +123,20 @@ table.tablesorter tbody tr:hover td, table.tablesorter tbody tr:hover a{ color: #000; } +table.imagestable, +table.imagestable a { + font-size: 8pt; +} +table.imagestable { + margin-top: 15px; +} +table.imagestable tr.odd { + background: transparent; +} +table.imagestable tr.even { + background: transparent; +} + #Footer{ margin: 50px 0 10px; text-align: right; diff --git a/src/Extensions/GoogleSitemapSiteTreeExtension.php b/src/Extensions/GoogleSitemapSiteTreeExtension.php index fdcab53..99ddf1b 100644 --- a/src/Extensions/GoogleSitemapSiteTreeExtension.php +++ b/src/Extensions/GoogleSitemapSiteTreeExtension.php @@ -2,6 +2,7 @@ namespace Wilr\GoogleSitemaps\Extensions; +use SilverStripe\Assets\Image; use SilverStripe\ErrorPage\ErrorPage; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\LiteralField; @@ -138,4 +139,32 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension return (is_numeric($priority) && $priority <= 1.0) ? $priority : 0.5; } } + + public function ImagesForSitemap() + { + $list = new ArrayList(); + + foreach ($this->owner->hasOne() as $field => $type) { + if(is_a(singleton($type), 'Image')) { + $image = $this->owner->getComponent($field); + if($image && $image->exists()) { + $list->push($image); + } + } + } + foreach ($this->owner->hasMany() as $field => $type) { + if(is_a(singleton($type), 'Image')) { + $images = $this->owner->getComponents($field); + foreach ($images as $image) { + if ($image && $image->exists()) { + $list->push($image); + } + } + } + } + + $this->owner->extend('updateImagesForSitemap', $list); + return $list; + } + } diff --git a/templates/Wilr/GoogleSitemaps/Control/GoogleSitemapController_sitemap.ss b/templates/Wilr/GoogleSitemaps/Control/GoogleSitemapController_sitemap.ss index 529e8d4..0a573c8 100644 --- a/templates/Wilr/GoogleSitemaps/Control/GoogleSitemapController_sitemap.ss +++ b/templates/Wilr/GoogleSitemaps/Control/GoogleSitemapController_sitemap.ss @@ -1,12 +1,17 @@ - + <% loop $Items %> $AbsoluteLink <% if $LastEdited %>$LastEdited.Rfc3339()<% end_if %> <% if $ChangeFrequency %>$ChangeFrequency<% end_if %> <% if $GooglePriority %>$GooglePriority<% end_if %> + <% if $ImagesForSitemap %><% loop $ImagesForSitemap %> + + {$AbsoluteLink} + + <% end_loop %><% end_if %> <% end_loop %> diff --git a/xsl/xml-sitemap.xsl b/xsl/xml-sitemap.xsl index 1ef5e55..a716346 100644 --- a/xsl/xml-sitemap.xsl +++ b/xsl/xml-sitemap.xsl @@ -37,9 +37,36 @@ + + + + + + + + + + + + + + + + + +
Images
+ + + + + +
+
+ +