+3

All of date's news for a date in the past?

Brice Bertels 8 years ago in BLOX CMS updated by Nick 8 years ago 3

Just wondering if any had any input on this?


Here's the goal: Provide a datepicker interface that will select any date and display a page with all of the assets published on that day, on one page.


Approach 1: Custom search page.

Starting point is something like this: http://www.columbiatribune.com/search/?d=2016-04-09&l=100&app=editorial&type=article

Using the search parameters: http://help.bloxcms.com/knowledge-base/applications/design/templates/modules/by_application/type/search/article_33ecc2fa-6e9a-11e5-b11b-6f69a19d81ac.html


Ideally, we want to put all of a single section's news, grouped with its peers (other articles of the section) and sorted by display priority. For instance, display all of /news/ section and it's children, sorted by display priority. After that, display all of /sports/ and it's children, sorted by priority as well.

You can do this, but you can't do it on one page. You could do all of /sports/ like http://www.columbiatribune.com/search/?d=2016-04-09&type=article&c[]=sports* but you would have to ajax these onto the page in order to display multiple sections.


One way around this problem is to filter the array of search results that you get back.

searchResults = cms.search.results;
articleGroup = tribune_filterAssetsByType(searchResults,'article','include');
newsGroup = tribune_filterByTopSection(newsGroup,'perspectives','exclude'); 
sportsGroup = tribune_filterByTopSection(articleGroup,'sports','include');

Where the filter macros just look for the appropriate sections or type and only return the correct ones. Because you're filtering by priority, this works, because you're not messing with the sorting, you're iterating in order. Behold, a list of assets of a section, sorted by priority, just like we want.

So this works great except for one sort of big caveat: When you have over 100 stories, it's incomplete. You can't return more than 100 search results at once, so you're stuck either ajaxing in the remainder after page load, which requires you writing a second version of your filtering at the script layer to do this... An inelegant solution at best.

Fantasy Approach 2: Using blocks


This isn't possible as far as I know right now. It also avoids all custom programming sorts of stuff and fits right into the "everything is a block" paradigm and that's great. If you had some way to grab url query parameters or read POST parameters out of the page request inside the block query rules, you could do some cool stuff.

Here's an example of how this might work:

In block query rules, you add "Start Date time" rule. In the operation list, there's a "From Request" and then an input to enter the name of a URL parameter.

That's all the user facing stuff that would be needed.

This blows open what is possible with blocks, IMHO. I could build my project above in 15 minutes and be done.

With this and some way to define URL routes and act on them, BLOX becomes a much more powerful framework. Say you wanted to make /archive/2015/ point to a landing page for 2015 or archive yyyy to go to any year's page, but you didn't want to define hundreds of years by hand and thousands of months under them, you need some sort of routing interface and some way to get that routing info into the Blocks.


Only actual approach 3: Using javascript


The search page has a JSON output, with f=json. That means I could load lots of search pages with whatever parameters I choose, parse the JSON, and build a page. Downsides, I need to make a version of card_summary in JS to put the things on the page.


This would be good practice for a native app as well.



+2

I did approach 3: http://www.columbiatribune.com/archive/


I still feel that capturing request parameters and using them in block query rules is one of the most powerful things TownNews could add to BLOX.

+1

I would like to see this too.