Skip to content

Commit 35e4271

Browse files
committed
Tags in the default template are relative to the blog app route
Also: the blog / list apps do not have a base_url, only the whole application Produce working URLs whether the blog app route ends with `/` or not, through joining on `/` and doing `=~s{//}{/}r` Discussion in preaction#585
1 parent 24f6c25 commit 35e4271

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/Statocles/App/Blog.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sub _routify {
2525

2626
sub register {
2727
my ( $self, $app, $conf ) = @_;
28-
my $route = _routify( $app, delete $conf->{route} // $conf->{base_url} );
28+
my $route = _routify( $app, $conf->{route} );
2929
my $filter = { %{ delete $conf->{filter} // {} }, date => { '!=' => undef }, status => { '!=' => 'draft'}};
3030
push @{$app->renderer->classes}, __PACKAGE__, 'Statocles::App::List';
3131
my $index_route = $route->get( '<page:num>' )->to(

lib/Statocles/App/List.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sub _routify {
2323

2424
sub register {
2525
my ( $self, $app, $conf ) = @_;
26-
my $route = _routify( $app, delete $conf->{route} // $conf->{base_url} );
26+
my $route = _routify( $app, $conf->{route} );
2727
push @{$app->renderer->classes}, __PACKAGE__;
2828
my $index_route = $route->get( '<page:num>' )->to(
2929
'yancy#list',

lib/Statocles/resources/theme/bootstrap/blog.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
% if ( $item->{tags} ) {
1111
<p class="tags">Tags:
1212
% for my $tag ( @{$item->{tags}} ) {
13-
<a href="<%= url_for( "/tag/$tag") %>" rel="tag"><%== $tag %></a>
13+
<a href="<%= url_for( join ("/", $config->{apps}{blog}{route}, "tag/$tag") =~ s{//}{/}r) %>" rel="tag"><%== $tag %></a>
1414
% }
1515
</p>
1616
% }

lib/Statocles/resources/theme/default/blog.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
% if ( $item->{tags} ) {
2424
<p class="tags">Tags:
2525
% for my $tag ( @{$item->{tags}} ) {
26-
<a href="<%= url_for( "/tag/$tag") %>" rel="tag"><%== $tag %></a>
26+
<a href="<%= url_for( join ("/", $config->{apps}{blog}{route}, "tag/$tag") =~ s{//}{/}r) %>" rel="tag"><%== $tag %></a>
2727
% }
2828
</p>
2929
% }

0 commit comments

Comments
 (0)