MTでプラグインを使わずに静的ページをページ分割する

インデックス表示用のメインテンプレートに下記を入れればページ分割されるようにはなりますが、2ページ目以降のURLがなど、だいぶややこしいことになります。

例えばhttp://ドメイン.com/mt/mt-search.cgi?IncludeBlogs=12&template_id=345&limit=1&archive_type=Index&page=2など。。

<div id="alpha-inner">

<mt:Ignore><!-- Set the number of entries displayed on each page. --></mt:Ignore>
<$mt:Var name="entries_per_page" value="1"$>

<mt:Ignore><!-- Construct the url for querying entries. --></mt:Ignore>
<mt:SetVarBlock name="search_link">
    <$mt:CGIPath$><$mt:SearchScript$>?IncludeBlogs=<$mt:BlogID$>
    &template_id=<$mt:BuildTemplateID$>
    &limit=<$mt:Var name="entries_per_page"$>
    &archive_type=Index
    &page=
</mt:SetVarBlock>
<mt:Ignore><!-- Strip spaces and trim value. --></mt:Ignore>
<$mt:Var name="search_link" strip="" trim="1" setvar="search_link"$>

<mt:Ignore><!-- Entries loop for publishing static and dynamic pages. --></mt:Ignore>
<mt:Entries limit="$entries_per_page" search_results="1">
    <mt:Ignore><!-- Use the Entry Summary module for each entry published on this page. --></mt:Ignore>
    <$mt:Include module="ブログ記事の概要"$>
</mt:Entries>

<mt:Ignore><!-- Create pagination navigation. Condition based upon if page is statically or dynamically rendered using the search_results variable. --></mt:Ignore>
<mt:SetVarBlock name="pagination_navigation">
    <mt:If name="search_results">
        <mt:Ignore><!-- Navigation for dynamic pages (same as navigation found in the Search Results system template). --></mt:Ignore>
        <mt:IfPreviousResults>
            <a href="<$mt:PreviousLink$>" rel="prev" onclick="return swapContent(-1);">< Previous</a> 
        </mt:IfPreviousResults>
        <mt:PagerBlock>
            <mt:IfCurrentPage>
                <$mt:Var name="__value__"$>
            <mt:Else>
                <a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a>
            </mt:IfCurrentPage>
        </mt:PagerBlock>
        <mt:IfMoreResults>
             <a href="<$mt:NextLink$>" rel="next" onclick="return swapContent();">Next ></a>
        </mt:IfMoreResults>
    <mt:Else>
        <mt:Ignore><!-- Navigation for statically published page. --></mt:Ignore>
        <mt:If name="archive_template">
            <$mt:ArchiveCount setvar="total_entries"$>
        <mt:Else>
            <$mt:BlogEntryCount setvar="total_entries"$>
        </mt:If>
        <mt:Ignore><!-- If blog contains more entries than the number of entries to display per page. --></mt:Ignore>
        <mt:If name="total_entries" gt="$entries_per_page">
            <mt:Ignore><!-- Set the total number of entries to iterate through the pages. --></mt:Ignore>
            <mt:Ignore><!-- IF total entries divided by entries per page is a whole number. --></mt:Ignore>
            <mt:If name="total_entries" op="%" value="$entries_per_page" eq="0">
                <mt:Ignore><!-- Set total pages to total entries divided by entries per page. --></mt:Ignore>
                <$mt:Var name="total_entries" op="/" value="$entries_per_page" setvar="total_pages"$>
            <mt:Else>
                <mt:Ignore><!-- Get the remainder when dividing total entries by entries per page. --></mt:Ignore>
                <$mt:Var name="total_entries" op="%" value="$entries_per_page" setvar="remainder"$>
                <mt:Ignore><!-- Subtract remainder from total entries. --></mt:Ignore>
                <$mt:Var name="total_entries" op="-" value="$remainder" setvar="total_entries"$>
                <mt:Ignore><!-- Determine total pages by dividing total entries (minus remainder) by entries per page. --></mt:Ignore>
                <$mt:Var name="total_entries" op="/" value="$entries_per_page" setvar="total_pages"$>
                <mt:Ignore><!-- Add one page to handle the remainder of entries. --></mt:Ignore>
                <$mt:SetVar name="total_pages" op="++"$>
            </mt:If>
            <mt:Ignore><!-- Loop through total pages, creating links to all but the first page (which is the current page). --></mt:Ignore>
            <mt:For from="1" to="$total_pages" step="1">
            <mt:If name="__first__">
                <$mt:Var name="__index__"$>
            <mt:Else>
                <a href="<$mt:Var name="search_link"$><$mt:Var name="__index__"$>"><$mt:Var name="__index__"$></a>
            </mt:If> 
            </mt:For>
            <mt:Ignore><!-- Hard-coded link to the next page (page 2). --></mt:Ignore>
             <a href="<$mt:Var name="search_link"$>2" rel="next">Next »</a>
        </mt:If>
    </mt:If>
</mt:SetVarBlock>
<mt:Ignore><!-- Strip space and trim navigation code. --></mt:Ignore>
<$mt:Var name="pagination_navigation" strip=" " trim="1" setvar="pagination_navigation"$>

<div class="content-nav">
<mt:Ignore><!-- Output variable if exists. --></mt:Ignore>
<$mt:Var name="pagination_navigation" strip=" " trim="1" setvar="pagination_navigation"$>
<mt:If name="pagination_navigation">
    <div class="pagination-navigation">
        <$mt:Var name="pagination_navigation"$>
    </div>
</mt:If>    
</div>
</div>

参考:Pagination for Static Templates