Skip to content

Instantly share code, notes, and snippets.

@hideki-a
Created February 20, 2014 12:27
Show Gist options
  • Save hideki-a/9112410 to your computer and use it in GitHub Desktop.
Save hideki-a/9112410 to your computer and use it in GitHub Desktop.
MTのタグ検索ページを/tag/(タグ)/page/(ページ数)/のようなパスで表示する
server {
server_name www.anothersky.pw;
# 掲載省略
rewrite ^/tag/(.*?)/?(page/([0-9]+)/?)?$ /mt/mt-search.cgi?tag=$1&IncludeBlogs=1,2&page=$3 last;
# 掲載省略
}
<mt:RemoveBlank>
<$mt:CurrentPage setvar="current"$>
<$mt:TotalPages setvar="total"$>
<mt:If name="current" gt="2">
<mt:SetVarBlock name="previous_url">page/<$mt:Var name="current" op="--"$>/</mt:SetVarBlock>
</mt:If>
<mt:If name="current" lt="$total">
<mt:SetVarBlock name="next_url">page/<$mt:Var name="current" op="++"$>/</mt:SetVarBlock>
</mt:If>
<ul class="nav-contents">
<mt:IfPreviousResults><li class="prev"><a href="/tag/<$mt:SearchString encode_url="1"$>/<$mt:Var name="previous_url"$>">前のページへ</a></li></mt:IfPreviousResults>
<mt:IfMoreResults><li class="next"><a href="/tag/<$mt:SearchString encode_url="1"$>/<$mt:Var name="next_url"$>">次のページへ</a></li></mt:IfMoreResults>
</ul>
</mt:RemoveBlank>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment