Skip to content

Commit

Permalink
only allow html files in the sitemap.xml
Browse files Browse the repository at this point in the history
The sitemap is for search engines, so we should probably only have HTML
files inside.

Fixes #176
  • Loading branch information
preaction committed Dec 23, 2014
1 parent e86a5ca commit 8981211
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/Statocles/Site.pm
Expand Up @@ -226,7 +226,8 @@ sub write {
}

# Build the sitemap.xml
my @indexed_pages = grep { !$_->isa( 'Statocles::Page::Feed' ) } @pages;
# html files only
my @indexed_pages = grep { $_->path =~ /[.]html?$/ } @pages;
my $default_theme = Statocles::Theme->new( store => '::default' );
my $tmpl = $default_theme->template( site => 'sitemap.xml' );
$store->write_file( 'sitemap.xml', $tmpl->render( site => $self, pages => \@indexed_pages ) );
Expand Down
4 changes: 0 additions & 4 deletions t/site.t
Expand Up @@ -116,17 +116,13 @@ subtest 'sitemap.xml and robots.txt' => sub {
'/blog/tag/better/page-2.html' => '2014-06-02',
'/blog/tag/error-message/index.html' => '2014-05-22',
'/blog/tag/even-more-tags/index.html' => '2014-06-02',
'/static.txt' => $today,
'/static.yml' => $today,
);

my @posts = qw(
/blog/2014/04/23/slug.html
/blog/2014/04/30/plug.html
/blog/2014/05/22/(regex)[name].file.html
/blog/2014/06/02/more_tags.html
/static.txt
/static.yml
);

my @lists = qw(
Expand Down

0 comments on commit 8981211

Please sign in to comment.