BlockPress now has permlinks and posts by tag.

in #utopian-io7 years ago

BlockPress-Screenshot_2018-05-07_20-33-49.png

https://github.com/blockpress/blockpress.me

New Features

Permlink support

One of the challenges in building a functioning AJAX application is the problem of permanent links. Changing the content displayed on the page is one thing, but if you do not change the url, then refreshing, bookmarking or sharing the current address will only be sharing a link to the original page.

Often the job of interpreting this permanent address, or permlink, will be left to the back end code, such as PHP, ASP.Net or NodeJS. However, in a purely front end system we also have to handle loading of the right content in the front end code. To this end I decided to implement a querystring containing the page information.

As content in BlockPress is loaded via optional content modules, the first part of the string names the module, the rest are module dependent parameters. Each module must now implement a function for handling these parameters and loading the right content.

The content module is also responsible for updating the url with the correct permlink. I have implemented this for the two current modules, steem and static.

In order to successful allow navigation via the browsers back and forward buttons, I also had to implement a onpopstate event handler that calls the correct content module. This all now works smoothly and seamlessly.

For example see:

Firefox_Screenshot_2018-05-07T19-33-18.531Z.png

Post listing by tag, without specifying user

Up until now, BlockPress had only been able to list posts for an individual user. It had been able to filter that users posts by tag, but a listing by tag for all users was missing. I have now added this feature.

The callback function for displaying the posts is reused, no need to reinvent the wheel, or introduce needless code duplication. Instead a different 'get' function is called if no username is specified. This function calls steem.api.getDiscussionsByCreated instead of steem.api.getDiscussionsByAuthorBeforeDate as used for the authors post listing.

Commits

Loading right content from permlink urls

Updating URL and history with right permlink and history event handler

Post listing without user

Follow

You can now follow the progress of BlockPress.me CMS on various social media, including our new channel on steem chat, and our new @blockpress steem account!

Sort:  

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.034
BTC 90489.61
ETH 3100.75
USDT 1.00
SBD 2.93