Archive and Links Pages
-
Comments:
- here.
It would be nice to be able to have a links and/or archive page under blogsome: that just had a list of all links, or a list of all posts/months/days (whatever). The problem is that Pages cannot use template tags, and it is not much fun to update these pages by hand. A solution presented itself to me today, and it goes like this:
{if $smarty.server.REQUEST_URI == '/links/'}
{get_links_list}
{elseif $smarty.server.REQUEST_URI == '/archives/'}
{get_archives type='postbypost' limit='' format='html'}
{/if}
This code can go into the Main Page template, just after {content}
, or into the post.html
template if you’ve used my previous hack to get Pages processed by the post template. You’ll also need to create Pages: Links and Archives (if you use different names, be sure to ensure the page-slug is the one that is listed in the code above). I had to put a <br />
into each Page in order to get rid of all errors. You can see the results here: Archives, Links. It’s more than likely that a similar solution exists for categories: I’ll do that too. Update: Categories, Pages. Note: Make sure you have the slash following the URL when you try to access them. It may be possible to have a double {if}
clause (with slash and without), but I’m not sure yet… later works a treat:
{if $smarty.server.REQUEST_URI == '/links/' || $smarty.server.REQUEST_URI == '/links'}
{get_links_list}
And so on…