Help - Search - Members - Calendar
Full Version: Categories (or Tags) And Entry Lists
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
liquidcross
I want to add categories (or tags, not sure which) to my blog, but rather than having MT publish every entry in a certain category on a single archive page, I'd want to see a list of the proper entries. For example, I make a post that would be filed under "food." When the reader clicks the "food" link, it would bring up a list of all other entries filed under that category or tag. Plus, on the left side of my blog index page, I'd want a list of "Popular Topics," and the links on that list would be my categories/tags, each one linking to the aforementioned entry lists.

Unfortunately, I have absolutely no clue how to go about implementing any of this. I'm not even sure if I should use categories or tags! The only category/tag tutorials I've found are many years out of date, and don't apply to MT4 (obviously). Help!
Avia
Hey,

Let me just make sure I understand what you want. You want a page for each category, but instead of that page printing out the full content of all of the entries filed under that category, you just want those entries listed by title, right? So, say, you want a "Food" page, with a list of all the Food entries, and then a "Drink" page, with a list of all the Drink entries, and so on. Is that right?

If that's what you're looking for, then it sounds to me as if what you want is a category archive -- just configured a little bit differently than the way the archives are configured by default in the MT templates.

You can get this to work by creating a new archive template and then mapping your category archives onto that new template.

By default, MT maps your category archives onto a template called "Entry Listing" -- which, despite its name, isn't really set up to do a simple listing at all. smile.gif So why not create a new one that is?

For example, for really really simple list pages, you could just create a new archive template based on the Entry Listing template (copy and paste it, if you want), and then replace everything between the Header and the Footer with something like this:

CODE
<b>Entries filed under "<MTArchiveTitle>":</b>
<ul>
<MTEntries>
<li><a href="<MTEntryPermalink>"><MTEntryTitle></a></li>
</MTEntries>
</ul>


That would give you a very basic bulleted list of all of the entries filed under that category, linked to their Entry pages. You'd probably want to pretty it up a bit more, stick an h1 title in there somewhere, but you get the drift.

Once you've finished creating that new archive template, you'll want to make sure MT knows that it should map your category archives onto it, instead of onto the old template. Go into the edit screen for the old "Entry Listing" module. At the bottom of the screen, below the form where all the code goes, you'll see the Archive Mapping list. Delete the "Category" map from that template entirely. Then go to your new archive template and add the Category map to that one. Then republish, and you should be good to go.

For the "Popular Topics" list on the left side of the page...I assume mean you want it in the sidebar? There's a pre-made widget that ships with MT that I'm pretty sure does what you're looking for. I think it's called either "Categories" or "Category Archives." Something like that. You can find it in the Widget Templates.
liquidcross
Cool, thanks! I'm fiddling around with it right now. I do have a problem, though; I tried publishing "Category Archives Only," but got this error:

CODE
An error occurred publishing category '10': Publish error in template 'Entry Listing': Error in <mt:Include> tag: error in module Header: Error in <mt:Link> tag: Can't find template 'styles'
Avia
Yikes! That sounds scary. Gosh, I hope I didn't lead you astray...

Hmmm. Okay, well, I just tried it myself on a fresh install of MT, still set to that default Minimalist Red Style, and it worked fine for me.

Just for reference, this is what my new Archive Template, which I called "Category Test," looked like in full:

CODE
<MTSetVarBlock name="body_class">mt-archive-listing mt-<MTVar name="archive_class"></MTSetVarBlock>
<MTSetVar name="sidebar" value="1">
<MTSetVar name="module_about_context" value="1">
<MTSetVarBlock name="page_title"><$MTArchiveTitle$> Archives</MTSetVarBlock>
<MTSetVarBlock name="title"><$MTBlogName encode_html="1"$>: <$MTGetVar name="page_title"$></MTSetVarBlock>
<MTIf name="datebased_archive">
<MTSetVarBlock name="html_head">
<MTArchivePrevious><link rel="prev" href="<$MTArchiveLink$>" title="<$MTArchiveTitle encode_html="1"$>" /></MTArchivePrevious>
<MTArchiveNext><link rel="next" href="<$MTArchiveLink$>" title="<$MTArchiveTitle encode_html="1"$>" /></MTArchiveNext>
</MTSetVarBlock>
</MTIf>

<$MTInclude module="Header"$>

<b>Entries filed under "<MTArchiveTitle>":</b>
<ul>
<MTEntries>
<li><a href="<MTEntryPermalink>"><MTEntryTitle></a></li>
</MTEntries>
</ul>

<$MTInclude module="Footer"$>


(Some of that stuff -- like all of the date archives information -- really doesn't need to be there at all, but for simplicity's sake, I was trying out the "copy 'n' paste from Entry List, then just change the stuff between the header and the footer lines" method.)

If yours looks like that, then I have no idea what went wrong.

What style are you using? Are you using one of the defaults, or have you made your own? It looks to me as if the problem might lie there somehow.
liquidcross
QUOTE (Avia @ Jan 28 2008, 07:37 PM) *
Yikes! That sounds scary. Gosh, I hope I didn't lead you astray...

Hmmm. Okay, well, I just tried it myself on a fresh install of MT, still set to that default Minimalist Red Style, and it worked fine for me.

Just for reference, this is what my new Archive Template, which I called "Category Test," looked like in full:


(Some of that stuff -- like all of the date archives information -- really doesn't need to be there at all, but for simplicity's sake, I was trying out the "copy 'n' paste from Entry List, then just change the stuff between the header and the footer lines" method.)

If yours looks like that, then I have no idea what went wrong.

What style are you using? Are you using one of the defaults, or have you made your own? It looks to me as if the problem might lie there somehow.

I was able to fix it. Many thanks for your help! smile.gif
pallavi
QUOTE (liquidcross @ Jan 28 2008, 05:49 PM) *
QUOTE (Avia @ Jan 28 2008, 07:37 PM) *
Yikes! That sounds scary. Gosh, I hope I didn't lead you astray...

Hmmm. Okay, well, I just tried it myself on a fresh install of MT, still set to that default Minimalist Red Style, and it worked fine for me.

Just for reference, this is what my new Archive Template, which I called "Category Test," looked like in full:


(Some of that stuff -- like all of the date archives information -- really doesn't need to be there at all, but for simplicity's sake, I was trying out the "copy 'n' paste from Entry List, then just change the stuff between the header and the footer lines" method.)

If yours looks like that, then I have no idea what went wrong.

What style are you using? Are you using one of the defaults, or have you made your own? It looks to me as if the problem might lie there somehow.

I was able to fix it. Many thanks for your help! smile.gif


I am trying to to do the same thing, but I want to treat the top level categories as a main navigation, but for some reason it shows the number of entries next to it, i tried removing the count tag but that also removes the link, any ideas on how to maintain the link without getting the number of entries
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.