Archive link structure

Discuss PivotX 2.0.x here. Non-PivotX related discussions go in The Drain.

Archive link structure

Postby kangoo » Mon Feb 06, 2012 2:24 pm

Hello,
PivotX's link structure example.com/archive/2012/02/06/title-of-the-entry it isn't fully functional because when one types address example.com/archive/2012/ it doesn't generate a list of entries that have been published this year. Similarly, example.com/archive/2012/02/ doesn't display all the entries from this month.

I wonder if where are any plans to improve this? I know that example.com/archive/2012-m02 works instead but it would be really nice to have it all together.
kangoo
 
Posts: 32
Joined: Wed Jun 25, 2008 7:46 pm

Re: Archive link structure

Postby hansfn » Tue Feb 07, 2012 5:35 pm

Just add

Code: Select all
## Adding support for monthly archives with URLs of type example.com/archive/2012/02
RewriteRule ^archive/([1-2][0-9]{3})[/-]([0-1][0-9])[/-]?$ index.php?uri=$1-m$2&rewrite=archive [L,QSA]

above the standard PivotX rules for non-crufty URLs in your .htaccess file.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Archive link structure

Postby kangoo » Sat Feb 11, 2012 8:27 pm

It doesn't seem to work. I get 404 error.
kangoo
 
Posts: 32
Joined: Wed Jun 25, 2008 7:46 pm

Re: Archive link structure

Postby hansfn » Sat Feb 11, 2012 9:00 pm

Then you have made a mistake. Show me your complete .htaccess file (and if possible tell us the monthly link that gave a 404 error).
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Archive link structure

Postby kangoo » Sat Feb 25, 2012 6:58 am

Sorry for late reply. I just wanted to set up a fresh PivotX installation to make sure that I didn't break up something myself.

So, the .htaccess file now looks like this:

Code: Select all
DirectoryIndex index.php index.html index.htm

RewriteEngine On
# RewriteBase /

RewriteRule ^archive/(.*)/trackback/?$ index.php?trackback&uri=$1&rewrite=archive [L,QSA]
##RewriteRule ^archive/(.*)$ index.php?uri=$1&rewrite=archive [L,QSA]
RewriteRule ^archive/([1-2][0-9]{3})[/-]([0-1][0-9])[/-]?$ index.php?uri=$1-m$2&rewrite=archive [L,QSA]

RewriteRule ^entry/(.*)/trackback/?$ index.php?trackback&e=$1&rewrite=entry [L,QSA]
RewriteRule ^entry/(.*)$ index.php?e=$1&rewrite=entry [L,QSA]
# Note: The two following rules match any date from year 1000 up to year 3000
# pretty strictly to avoid matching page URIs starting with numbers ...
RewriteRule ^([1-2][0-9]{3})[/-]([0-1][0-9][/-][0-3][0-9](/.*)?)/trackback/?$ index.php?trackback&uri=$1/$2&rewrite=archive [L,QSA]
RewriteRule ^([1-2][0-9]{3})[/-]([0-1][0-9][/-][0-3][0-9](/.*)?)$ index.php?uri=$1/$2&rewrite=archive [L,QSA]
RewriteRule ^page/(.*)$ index.php?uri=$1&rewrite=page [L,QSA]
RewriteRule ^tag/(.*)$ index.php?t=$1&rewrite=tag [L,QSA]
RewriteRule ^tags(/([^/]*)/?)?$ index.php?x=tagpage&w=$2 [L,QSA]
RewriteRule ^search/(.*)$ index.php?q=$1&rewrite=search [L,QSA]
RewriteRule ^search$ index.php?rewrite=search [L,QSA]
RewriteRule ^visitor(/([^/]*)/?)?$ index.php?x=visitorpage&w=$2 [L,QSA]
RewriteRule ^category/(.*)$ index.php?c=$1&rewrite=category [L,QSA]
RewriteRule ^weblog/(.*)$ index.php?w=$1 [L,QSA]
RewriteRule ^author/(.*)$ index.php?u=$1&rewrite=author [L,QSA]
RewriteRule ^browse/(.*)$ index.php?o=$1&rewrite=offset [L,QSA]
RewriteRule ^rss(/.*)?$ index.php?feed=rss$1&rewrite=feed [L,QSA]
RewriteRule ^atom(/.*)?$ index.php?feed=atom$1&rewrite=feed [L,QSA]

# Fallback for non-existing pages: Show the PivotX 404 page instead.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(([a-z0-9_-]+)(/([a-z0-9_-]*))?)$ index.php?uri=$1&rewrite=page [L,QSA]


But when I try it with http://process.lv/archive/2012/02/25/ it gives me 404 error.
kangoo
 
Posts: 32
Joined: Wed Jun 25, 2008 7:46 pm

Re: Archive link structure

Postby hansfn » Sat Feb 25, 2012 7:37 am

I said monthly archives. http://process.lv/archive/2012/02/ works - that is the monthly URL.

PivotX doesn't have a function for daily archives so http://process.lv/archive/2012/02/XX needs to be redirected somewhere ... maybe to the monthly archive?
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Archive link structure

Postby kangoo » Sat Feb 25, 2012 7:53 pm

OK, now I got it. :)

Anyway, I wanted to say that in the future PivotX releases it would be nice to have yearly and daily archives, too (just like Pivot 1 had through archive_dynamic.php file).
kangoo
 
Posts: 32
Joined: Wed Jun 25, 2008 7:46 pm

Re: Archive link structure

Postby Harm10 » Sat Feb 25, 2012 10:02 pm

kangoo wrote:it would be nice to have yearly and daily archives.
Yearly archives are already possible (just submitted a documentation change).
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Archive link structure

Postby hansfn » Tue Feb 28, 2012 12:08 am

Harm is correct that PivotX supports yearly archives. The corresponding rewrite rule is:

Code: Select all
## Adding support for yearly archive as example.com/archive/2012
RewriteRule ^archive/([1-2][0-9]{3})/?$ index.php?uri=$1-y00&rewrite=archive [L,QSA]
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Archive link structure

Postby Colp » Sat Mar 03, 2012 5:26 pm

Only just noticed this myself. Thanks for posting. Both code entries work perfectly for me.
Colp
 
Posts: 45
Joined: Thu Nov 17, 2011 12:36 am
Location: Middlesbrough, UK


Return to 2.x Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron