user-pic

Pagination on front page

Vote 0 Votes

Are there any simple options other than plugins to enable pagination on the front page or any other page for that matter?

Reported on Movable Type 4.2

10 Replies

| Add a Reply
  • Not sure if this is what you're looking for, but if your front page has 30 entries, this will send readers to the 31st if, in your monthly archives, the title has an id of its entry ID:

    <mt:entries lastn="1" include_blogs="1" offset="30"><a href="<$mt:blogurl$><$mt:entrydate format="%Y/%m/"$>#entry-<$mt:entryid$>">Next &raquo;</a></mt:entries>
    

    It isn't true pagination, but it basically turns your monthly archives into extensions of your front page.

  • Very interesting.. this is my existing main index template, so how would I incorporate the above? (sorry i'm new)

    • Mike:

      The code on that page is less important than your archive structure. The code I posted assumes a monthly archive structure with a URL of www.sample.com/2009/05/ for the May 2009 archive. Are you publishing monthly archives? What does the URL for one of them look like? If it's different from what I've described, this won't work properly. But if you tell me what structure looks like, we can adapt it.

      Beyond that, there needs to be an id associated with each entry on your monthly archive. If you're using an entry summary on your monthly archive page, you could add an id to div or h2 element (or just about anything else at the top of the summary) by adding this to it:

      id="entry-"

      E.g.:

      <h2 id="entry-<$mt:entryid$>"><mt:entrytitle></h2>
      
      • Trying again ...

        --

        Mike:

        The code on that page is less important than your archive structure. The code I posted assumes a monthly archive structure with a URL of www.sample.com/2009/05/ for the May 2009 archive. Are you publishing monthly archives? What does the URL for one of them look like? If it's different from what I've described, this won't work properly. But if you tell me what structure looks like, we can adapt it.

        Beyond that, there needs to be an id associated with each entry on your monthly archive. If you're using an entry summary on your monthly archive page, you could add an id to div or h2 element (or just about anything else at the top of the summary) by adding this to it:

        id="entry-<$mt:entryid$>"
        

        E.g.:

        <h2 id="entry-<$mt:entryid$>"><mt:entrytitle></h2>
        
  • I have some blogs that are far too busy to show an entire month's posts, so I've enabled weekly archives, and created an "Entries Footer" template module (anything in it displays after the last entry) that contains only this:

    <MTEntriesFooter>
    <MTEntryPrevious>
    <a href="<$MTEntryLink archive_type="Weekly"$>">Keep going: Page back through previous weeks' entries</a>
    </MTEntryPrevious>
    </MTEntriesFooter>

    It goes into Main Index like this:

    <MTEntries>
    <$MTInclude module="Entry Summary"$>
    <$MTInclude module="Entries Footer"$>
    </MTEntries>

    You do get some repetition of posts in the current week, but I can live with that; you could perhaps combine them, use the next entry's id like an anchor to land on the sequentially next entry, as Culture Snob does.

  • I'd like to attempt to use Culture snobs' idea but I can't seem to get it to work correctly.

  • You might check out A Quick Pagination Hack for Movable Type. Or, if you're a bit more programming-savvy, take a look at the Motion template set and how it uses the mtShowPage AJAX method along with a custom search handler to do pagination.

  • I don't think I've been clear on my method. I'm going to try again.

    If you want "pagination" on the front page -- that is, you want a link at the bottom of the front page sending readers to a list of older entries that begins with the next entry in your archive -- you can do it very simply if (1) your front page is limited to a certain number of entries (rather than a certain number of days) and (2) you are publishing weekly/monthly/yearly archives.

    The code will vary, but if you meet both those requirements, it's easy to implement; you only need to drop a line of code in the main index and one in either the entries loop of your date-based archive or the entry summary (if that's what your date-based archive calls).

    This is the code for the main index from my blog:

    <mt:entries lastn="1" include_blogs="1" offset="30"><a href="<$mt:blogurl$><$mt:entrydate format="%Y/%m/"$>#entry-<$mt:entryid$>">Next &raquo;</a></mt:entries>
    

    It would need to be customized for the URL format of your date-based archive, and it assumes that your front page shows 30 entries.

    What it requires on your date-based archive is an id element for each entry that matches the format from the main-page link. In the case of my code, that's entry-<$mt:entryid$>.

    So at the bottom of my main page is a link to this:

    http://www.culturesnob.net/2009/01/#entry-1449

    And that links to January 2009 archive and finds the entry with an id of "entry-1449".

    I'm sure I'm making it sound more complicated than it actually is, but my point (unclear in my first [and probably second]) reply is that the code I posted won't work unless some other things are done.

  • thanks everybody, i have learned something ,too.
    -------------------------------------------------
    welcome to shopping747.com,you may have something you need

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1195 3842

Last Topic: Comment form customization by anisa on Feb 8, 2010

60 184

Last Topic: Dynamic Publishing - Blank Screen by Sivaram M on Dec 15, 2009

955 2987

Last Topic: MT5 - Cookie Problems by Dave Cross on Feb 9, 2010

68 213

Last Topic: How to add Custom Fields by gregoryttp on Feb 5, 2010

19 67

Last Topic: Custom main index page by Richard on Feb 7, 2010

42 169

Last Topic: I want to write my own wordpress plugin by Xarzu on Jan 31, 2010

11 21

Last Topic: Monthly Calendars Help Needed by joe leblanc on Jan 19, 2010

91 326

Last Topic: SpamLookup Keyword Filter 2.1 not work by b.n09 on Nov 17, 2009

52 178

Last Topic: Assets - No options by Chelle on Feb 5, 2010

code.sixapart.com

128 444

Last Topic: ActionStream with Movable Type 5.01 by Parneix on Jan 24, 2010

154 468

Last Topic: URGENT! Help needed w/ Virus by PhilContrino on Feb 1, 2010