Remove dead code in PAGE-URL.

We partially support 'pretty URLs'. They can be achieved by setting
:page-ext in the *config* to "/" and configuring the web server to
ignore html extensions.
This commit is contained in:
Brit Butler 2014-04-08 16:59:56 -04:00
parent e429d94f3f
commit 3ee8f43325
7 changed files with 19 additions and 22 deletions

View file

@ -16,13 +16,10 @@
(:documentation "The url to the object, without the domain.")) (:documentation "The url to the object, without the domain."))
(defmethod page-url :around ((object t)) (defmethod page-url :around ((object t))
(let ((result (call-next-method)) (let ((result (call-next-method)))
(extension (if (string= (page-ext *config*) "/")
"html"
(page-ext *config*))))
(if (pathname-type result) (if (pathname-type result)
result result
(make-pathname :type extension :defaults result)))) (make-pathname :type (page-ext *config*) :defaults result))))
(defun page-path (object) (defun page-path (object)
"The path to store OBJECT at once rendered." "The path to store OBJECT at once rendered."

View file

@ -14,7 +14,7 @@
{foreach $post in $content.posts} {foreach $post in $content.posts}
<entry> <entry>
<link type="text/html" rel="alternate" href="{$config.domain}/posts/{$post.slug}.html"/> <link type="text/html" rel="alternate" href="{$config.domain}/posts/{$post.slug}{$config.pageExt}"/>
<title>{$post.title}</title> <title>{$post.title}</title>
<published>{$post.date}</published> <published>{$post.date}</published>
<updated>{$post.date}</updated> <updated>{$post.date}</updated>

View file

@ -4,20 +4,20 @@
<h1 class="title">{$index.title}</h1> <h1 class="title">{$index.title}</h1>
{foreach $post in $index.posts} {foreach $post in $index.posts}
<div class="article-meta"> <div class="article-meta">
<a class="article-title" href="{$config.domain}/posts/{$post.slug}.html">{$post.title}</a> <a class="article-title" href="{$config.domain}/posts/{$post.slug}{$config.pageExt}">{$post.title}</a>
<div class="date"> posted on {$post.date}</div> <div class="date"> posted on {$post.date}</div>
<div class="article">{$post.text |noAutoescape}</div> <div class="article">{$post.text |noAutoescape}</div>
</div> </div>
{/foreach} {/foreach}
<div id="relative-nav"> <div id="relative-nav">
{if $prev} <a href="{$prev}.html">Previous</a> {/if} {if $prev} <a href="{$prev}{$config.pageExt}">Previous</a> {/if}
{if $next} <a href="{$next}.html">Next</a> {/if} {if $next} <a href="{$next}{$config.pageExt}">Next</a> {/if}
</div> </div>
{if $tags} {if $tags}
<div id="tagsoup"> <div id="tagsoup">
<p>This blog covers <p>This blog covers
{foreach $tag in $tags} {foreach $tag in $tags}
<a href="{$config.domain}/tag/{$tag.slug}.html">{$tag.name}</a>{nil} <a href="{$config.domain}/tag/{$tag.slug}{$config.pageExt}">{$tag.name}</a>{nil}
{if not isLast($tag)},{sp}{/if} {if not isLast($tag)},{sp}{/if}
{/foreach} {/foreach}
</div> </div>
@ -26,7 +26,7 @@
<div id="monthsoup"> <div id="monthsoup">
<p>View posts from <p>View posts from
{foreach $month in $months} {foreach $month in $months}
<a href="{$config.domain}/date/{$month}.html">{$month}</a>{nil} <a href="{$config.domain}/date/{$month}{$config.pageExt}">{$month}</a>{nil}
{if not isLast($month)},{sp}{/if} {if not isLast($month)},{sp}{/if}
{/foreach} {/foreach}
</div> </div>

View file

@ -5,7 +5,7 @@
<h1 class="title">{$post.title}</h1>{\n} <h1 class="title">{$post.title}</h1>{\n}
<div class="tags">{\n} <div class="tags">{\n}
Tagged as {foreach $tag in $post.tags} Tagged as {foreach $tag in $post.tags}
<a href="../tag/{$tag.slug}.html">{$tag.name}</a>{nil} <a href="../tag/{$tag.slug}{$config.pageExt}">{$tag.name}</a>{nil}
{if not isLast($tag)},{sp}{/if} {if not isLast($tag)},{sp}{/if}
{/foreach} {/foreach}
</div>{\n} </div>{\n}
@ -17,7 +17,7 @@
{$post.text |noAutoescape} {$post.text |noAutoescape}
</div>{\n} </div>{\n}
<div class="relative-nav">{\n} <div class="relative-nav">{\n}
{if $prev} <a href="{$config.domain}/posts/{$prev.slug}.html">Previous</a><br> {/if}{\n} {if $prev} <a href="{$config.domain}/posts/{$prev.slug}{$config.pageExt}">Previous</a><br> {/if}{\n}
{if $next} <a href="{$config.domain}/posts/{$next.slug}.html">Next</a><br> {/if}{\n} {if $next} <a href="{$config.domain}/posts/{$next.slug}{$config.pageExt}">Next</a><br> {/if}{\n}
</div>{\n} </div>{\n}
{/template} {/template}

View file

@ -4,7 +4,7 @@
<h1 class="page-header">{$index.title}</h1> <h1 class="page-header">{$index.title}</h1>
{foreach $post in $index.posts} {foreach $post in $index.posts}
<div class="row-fluid"> <div class="row-fluid">
<h1><a href="{$config.domain}/posts/{$post.slug}.html">{$post.title}</a></h1> <h1><a href="{$config.domain}/posts/{$post.slug}{$config.pageExt}">{$post.title}</a></h1>
<p class="date-posted">posted on {$post.date}</p> <p class="date-posted">posted on {$post.date}</p>
{$post.text |noAutoescape} {$post.text |noAutoescape}
</div> </div>
@ -13,7 +13,7 @@
<div class="row-fluid"> <div class="row-fluid">
<p>This blog covers <p>This blog covers
{foreach $tag in $tags} {foreach $tag in $tags}
<a href="{$config.domain}/tag/{$tag.slug}.html">{$tag.name}</a>{nil} <a href="{$config.domain}/tag/{$tag.slug}{$config.pageExt}">{$tag.name}</a>{nil}
{if not isLast($tag)},{sp}{/if} {if not isLast($tag)},{sp}{/if}
{/foreach} {/foreach}
</p> </p>
@ -23,7 +23,7 @@
<div class="row-fluid"> <div class="row-fluid">
<p>View posts from <p>View posts from
{foreach $month in $months} {foreach $month in $months}
<a href="{$config.domain}/date/{$month}.html">{$month}</a>{nil} <a href="{$config.domain}/date/{$month}{$config.pageExt}">{$month}</a>{nil}
{if not isLast($month)},{sp}{/if} {if not isLast($month)},{sp}{/if}
{/foreach} {/foreach}
</p> </p>

View file

@ -5,7 +5,7 @@
<h1 class="page-header">{$post.title}</h1>{\n} <h1 class="page-header">{$post.title}</h1>{\n}
<p>Tagged as <p>Tagged as
{foreach $tag in $post.tags} {foreach $tag in $post.tags}
<a href="../tag/{$tag.slug}.html">{$tag.name}</a>{nil} <a href="../tag/{$tag.slug}{$config.pageExt}">{$tag.name}</a>{nil}
{if not isLast($tag)},{sp}{/if} {if not isLast($tag)},{sp}{/if}
{/foreach} {/foreach}
</p> </p>
@ -14,8 +14,8 @@
{$post.text |noAutoescape} {$post.text |noAutoescape}
<ul class="pager"> <ul class="pager">
{if $prev}<li class="previous"><a href="{$config.domain}/posts/{$prev.slug}.html">&larr; Previous</a></li>{/if}{\n} {if $prev}<li class="previous"><a href="{$config.domain}/posts/{$prev.slug}{$config.pageExt}">&larr; Previous</a></li>{/if}{\n}
{if $next}<li class="next"><a href="{$config.domain}/posts/{$next.slug}.html">Next &rarr;</a></li>{/if}{\n} {if $next}<li class="next"><a href="{$config.domain}/posts/{$next.slug}{$config.pageExt}">Next &rarr;</a></li>{/if}{\n}
</ul> </ul>
</div>{\n} </div>{\n}
{/template} {/template}

View file

@ -13,10 +13,10 @@
{foreach $post in $content.posts} {foreach $post in $content.posts}
<item> <item>
<title>{$post.title}</title> <title>{$post.title}</title>
<link>{$config.domain}/posts/{$post.slug}.html</link> <link>{$config.domain}/posts/{$post.slug}{$config.pageExt}</link>
<pubDate>{$post.date}</pubDate> <pubDate>{$post.date}</pubDate>
<author>{$config.author}</author> <author>{$config.author}</author>
<guid isPermaLink="true">{$config.domain}/posts/{$post.slug}.html</guid> <guid isPermaLink="true">{$config.domain}/posts/{$post.slug}{$config.pageExt}</guid>
{foreach $tag in $post.tags} {foreach $tag in $post.tags}
<category><![CDATA[ {$tag} ]]></category> <category><![CDATA[ {$tag} ]]></category>
{/foreach} {/foreach}