I have a content folder with numerous dated articles. I would like to somehow route the default homepage to simply show the most recent article using the article template (building off the ‘Get Started with Kirby’ starter site). In other words, when you go to example.com, it’ll just autoroute to example.com/article-name.
I also tried forcing the home template to grab the most recent article but the prevnext snippet doesn’t work right and it seems redundant to duplicate that code.
Follow up question — is there a way to make the url update accordingly? i.e. I enter website.com but the site automatically redirects to website.com/articlename
Hm, that’s strange. If you set home to a subpage, it should return the subpage. I can’t really reproduce your redirect. Are you using any routes that might interfere, maybe?
Just to clarify, the current behavior is I enter website.com and get website.com with the last article displayed. I would like the site to actually display that article’s url, i.e. website.com/articlename.
Hm, not sure how to achieve this without running into an endless loop. Maybe instead of setting the child page as the homepage redirect the home page to the subpage?
How would I set that up dynamically, if the most recent article changes? I guess it would be ok if the first article was just website.com but it seems to clunk up the javascript ajax navigation stuff I’m doing.
Maybe a better question is why the else statements in this pagination snippet return website.com instead of website.com/first-article. Going off of this thread: Navigation / pagination loop
$page->last() and $page->first() doesn’t make sense. These methods are only valid in collections… and a single $page object is not a Collection/Pages object.
But this whole thing is intended to be used between siblings, the homepage, however, is not part of the siblings collection.