Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

2.4 archive problem


Reply

11 Posts   2071 Views

Avatar
shakingpaper

15 June 2010 at 10:19am Community Member, 15 Posts

I switched to Yearly & still 404'ing.

I have two blog modules set up - one called News, the other Blog so don't think it is a naming issue.

Very peculiar.

Avatar
shakingpaper

8 August 2010 at 4:26pm Community Member, 15 Posts

Have there been any further developments with this issue? Have tried a few fixes and still getting 404's on archive pages.

Avatar
mawk

4 October 2011 at 2:33pm Community Member, 4 Posts

Ok so here's how I got it working. The urls the archive widgets were creating were like http://mydomain/blogname/year/month. after reading this thread. http://www.silverstripe.org/blog-module-forum/show/7839, I realized what the $allowed_actions were doing which also allowed the calendar, which had a similar functionality to use a /view/year-month url. thinking someone would likely do the same for the blog so I looked at the $allowed_actions in /blog/code/BlogHolder.php and found one called "date" so I added that to the url and it worked. Then i found where the urls were being created and went into blog/code/widgets/ArchiveWidget.php and changed lines 90 - 94 to prepend the "date/" value:

if($isMonthDisplay) {
   $link = $container->Link("date/".$sqlResult['Year']) . '/' . sprintf("%'02d", $monthVal);
} else {
   $link = $container->Link("date/".$sqlResult['Year']);
}

this changed the archive url to http://mydomain/blogname/date/year/month and that worked. i'm not sure if someone built it in and forgot to update the widget or what but hopefully it saves someone else some headscratching time.