Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » 2.4 archive problem

Discuss the Blog Module.

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

Page: 1 2
Go to End
Author Topic: 2036 Views
  • shakingpaper
    Avatar
    Community Member
    15 Posts

    Re: 2.4 archive problem Link to this post

    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.

  • shakingpaper
    Avatar
    Community Member
    15 Posts

    Re: 2.4 archive problem Link to this post

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

  • mawk
    Avatar
    Community Member
    4 Posts

    Re: 2.4 archive problem Link to this post

    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.

    2036 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.