Explorar el Código

Fix #66: video/image sitemap usage

George S. Baugh hace 5 años
padre
commit
79d9316060
Se han modificado 1 ficheros con 15 adiciones y 1 borrados
  1. 15 1
      lib/Trog/Routes/HTML.pm

+ 15 - 1
lib/Trog/Routes/HTML.pm

@@ -798,7 +798,21 @@ sub sitemap ($query, $render_cb) {
                     changefreq => $changefreq,
                     priority   => 1.0,
                 );
-                #TODO add video & preview image if applicable
+
+                #add video & preview image if applicable
+                $data{images} = [{
+                    loc => "http://$query->{domain}$url->{href}",
+                    caption => $url->{data},
+                    title => $url->{title},
+                }] if $url->{is_image};
+
+                $data{videos} = [{
+                    content_loc   => "http://$query->{domain}$url->{href}",
+                    thumbnail_loc => "http://$query->{domain}$url->{preview}",
+                    title         => $url->{title},
+                    description   => $url->{data},
+                }] if $url->{is_video};
+
                 $sm->add(%data);
             }
         }