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."))
(defmethod page-url :around ((object t))
(let ((result (call-next-method))
(extension (if (string= (page-ext *config*) "/")
"html"
(page-ext *config*))))
(let ((result (call-next-method)))
(if (pathname-type result)
result
(make-pathname :type extension :defaults result))))
(make-pathname :type (page-ext *config*) :defaults result))))
(defun page-path (object)
"The path to store OBJECT at once rendered."

View file

@ -14,7 +14,7 @@
{foreach $post in $content.posts}
<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>
<published>{$post.date}</published>
<updated>{$post.date}</updated>

View file

@ -4,20 +4,20 @@
<h1 class="title">{$index.title}</h1>
{foreach $post in $index.posts}
<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="article">{$post.text |noAutoescape}</div>
</div>
{/foreach}
<div id="relative-nav">
{if $prev} <a href="{$prev}.html">Previous</a> {/if}
{if $next} <a href="{$next}.html">Next</a> {/if}
{if $prev} <a href="{$prev}{$config.pageExt}">Previous</a> {/if}
{if $next} <a href="{$next}{$config.pageExt}">Next</a> {/if}
</div>
{if $tags}
<div id="tagsoup">
<p>This blog covers
{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}
{/foreach}
</div>
@ -26,7 +26,7 @@
<div id="monthsoup">
<p>View posts from
{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}
{/foreach}
</div>

View file

@ -5,7 +5,7 @@
<h1 class="title">{$post.title}</h1>{\n}
<div class="tags">{\n}
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}
{/foreach}
</div>{\n}
@ -17,7 +17,7 @@
{$post.text |noAutoescape}
</div>{\n}
<div class="relative-nav">{\n}
{if $prev} <a href="{$config.domain}/posts/{$prev.slug}.html">Previous</a><br> {/if}{\n}
{if $next} <a href="{$config.domain}/posts/{$next.slug}.html">Next</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}{$config.pageExt}">Next</a><br> {/if}{\n}
</div>{\n}
{/template}

View file

@ -4,7 +4,7 @@
<h1 class="page-header">{$index.title}</h1>
{foreach $post in $index.posts}
<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>
{$post.text |noAutoescape}
</div>
@ -13,7 +13,7 @@
<div class="row-fluid">
<p>This blog covers
{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}
{/foreach}
</p>
@ -23,7 +23,7 @@
<div class="row-fluid">
<p>View posts from
{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}
{/foreach}
</p>

View file

@ -5,7 +5,7 @@
<h1 class="page-header">{$post.title}</h1>{\n}
<p>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}
{/foreach}
</p>
@ -14,8 +14,8 @@
{$post.text |noAutoescape}
<ul class="pager">
{if $prev}<li class="previous"><a href="{$config.domain}/posts/{$prev.slug}.html">&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 $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}{$config.pageExt}">Next &rarr;</a></li>{/if}{\n}
</ul>
</div>{\n}
{/template}

View file

@ -13,10 +13,10 @@
{foreach $post in $content.posts}
<item>
<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>
<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}
<category><![CDATA[ {$tag} ]]></category>
{/foreach}