OSDN Git Service

add redirect rule for /story/<tag or topic>/
authorhylom <hylom@users.sourceforge.jp>
Wed, 3 Apr 2019 10:18:30 +0000 (19:18 +0900)
committerhylom <hylom@users.sourceforge.jp>
Wed, 3 Apr 2019 10:18:30 +0000 (19:18 +0900)
src/newslash_web/lib/Newslash/Web.pm
src/newslash_web/templates/topics/topics.html.tt2

index b0a8223..4e28fb8 100644 (file)
@@ -293,6 +293,14 @@ sub startup {
     # archive page
     $r->get('/story/:year/:month/:day/')->to('archive#story');
     $r->get('/story/:year/:month/')->to('archive#story');
+
+    # redirect rule for /stroy/<tags or topics>/
+    $r->get('/story/:tag/' => [tag => qr{[^/ ]+}] => sub {
+        my $c = shift;
+        my $tag = $c->stash('tag');
+        $c->res->code(301);
+        $c->redirect_to("/tag/$tag/story/");
+    });
     $r->get('/story/')->to('archive#story');
 
     $r->get('/journal/:year/:month/:day/')->to('archive#journal');
@@ -354,7 +362,7 @@ sub startup {
     $r->get('/faq/')->to('faq#faq');
 
     # topics
-    $r->get('/topics.pl')->to(cb => sub {my $c = shift; $c->res->code(301); $c->redirect_to('/topics/'); });
+    $r->get('/topics.pl' => sub {my $c = shift; $c->res->code(301); $c->redirect_to('/topics/');});
     $r->get('/topics')->to('topics#topics');
 
     # authors
index 8adb6a7..9794294 100644 (file)
@@ -12,7 +12,7 @@
         [%- FOREACH topic = topics %]
         [%- IF topic.searchable == "yes" %]
         <div class="topic-item">
-          <a href="/stories/[% topic.keyword %]/">
+          <a href="/tag/[% topic.keyword %]/story/">
             [%- IF topic.image %]
             <img src="[% Site.topic_icon_base_url %]/[% topic.image %]" />
             [%- ELSE %]