Help - Search - Members - Calendar
Full Version: supressing a BLANK monthly archive
Movable Type Community Forum > Additional Resources > Tips and Tricks
scruffy
I have a photo blog, and I don't post pictures every month.

When I rebuild my blog it creates a monthly archive page even if I don't have any entries for this month.

For example: I have entries for November, but non for December.

A monthly archive page that doesn't have any pictures in it is being created.

Is it possible to stop months without any entries from being created?

thanks,
Eric
maddy
If you have no entries in that month, you should not be getting a page generated. huh.gif How have you set up your archiving?
scruffy
configuration/archiving

I have a MONTHLY /archive type selected using a template I created that displays the format of how I want my monthly page to look.

Eric
scruffy
I have figured out my problem...

I have a monthly archive page that only displays my "photo" categories. My other category "general" has entries on the blank months.

For the few months that have "general" entries and no "photo" categories, I get a blank monthly archive page.

Now all I need to do I figure out how to create monthly archive pages for each category, and put them in different folders...

Eric
scruffy
OK...could someone straighten me out on archiving??

I have a "monthly archive type". The "archive file template" is blank. By default it should create a 2003_12.php file in my archive directory.

This does happen smile.gif

I have created a "template" for this archive type.

CODE
<body bgcolor="#5F5E5D" text="#FFFFFF" TOPMARGIN=5 LEFTMARGIN=40 background="#5F5E5D">

<div id="center" align="center">
<br />

<MTArchivePrevious>
<a href="<$MTArchiveLink$>">« <$MTArchiveTitle$></a> |
</MTArchivePrevious>
<!--Home Button-->
<a href="<$MTBlogURL$>" target="_self" onmouseover="lighten('homearrow')" onmouseout="darken('homearrow')"><img src="<$MTBlogURL$>images/b-upgrey.gif" name="homearrow" alt="home" border="0"></a>
<MTArchiveNext>
| <a href="<$MTArchiveLink$>"><$MTArchiveTitle$> »</a>
</MTArchiveNext>

<br />

<div id="Banner" class="Banner"></div>
<br />

<div id="PhotoArchiveCell" class="PhotoArchiveCell">

<b>Photography Archive:</b> <$MTArchiveTitle$><br /><br />

<MTEntries category="Photos">

<div class="float">
<a href="<$MTEntryLink$>"><$MTEntryExcerpt$></a><br />
<p><$MTEntryDate format="%m-%d-%y"$><br /></p>
</div>

</MTEntries>
</div> <!-- PhotoArchiveCell -->
</div id="Center">


I have specified in the template that this is a specific category:

CODE
<MTEntries category="Photos">


Now please straight me out.

I only have 2 categories...Photos and General

I thought this would create a monthly photo archive.

It is creating a monthly archive, but it is creating an archive file for non Photo categories that do not display anything...

for example I have no Photos for 2003_12, but I do have General entries for 2003_12. A monthly archive is being created 2003_12.php, but it contains no photos.

Why is it being created at all??

help ohmy.gif
markpasc
The decision whether or not to build the file is made before MT looks at the template code. Only when MT starts chugging through the code does it realize you're only displaying photo entries... and actually, it doesn't even "realize" that then, in any meaningful way. It merely follows your directions and doesn't put anything in the page for your nonphoto entries. It's already decided to build those pages, whether there are photo entries that month or not.

You probably want to set up your photos and general categories as separate weblogs instead of categories.
scruffy
I was hoping for a different answer...

Anyone else have their 2 cents to add?

thanks huh.gif
girlie
There really isn't a different answer to add.

You're using MT in a way for which it really isn't intended - category archives by date are not supported per se.

You've chosen monthly archives, and are trying to further quantify them by category. MT is correctly building an archive for each month which has entries; you've just forced it to suppress the entries that aren't in a particular category. Entries for the month still exist, regardless of whether you choose to display them or not.

In other words, the generation of a monthly page has absolutely nothing to do with the category those entries have been assigned to.
scruffy
thank you all for your replies!!!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.