The post / article details page contains a series of buttons for sharing the post on social networks and managing comments:

rticle / post details page with social media and comments buttons
Article / post details page with social media and comments buttons

Managing Post Comments

Comments button and label

Each post contains a list of comments and a form for submitting new comments. The comments panel is opened by tapping on the comments button (see above picture). The comments button also indicates the total number of comments for the post, in case there are any. If a post doesn’t have any comments, the label with the number of comments will be hidden.

The comments button will be displayed:

  • if the post has comments (“no_comments” is greater than zero) or
  • if the post’s “comment_status” is set to “open”, indicating that users can add new comments
Displaying comments

The comments for a post are read using the exportcomments endpoint and displayed as following:

Comments list and form
Comments list and form

Optionally, the list can include a pull & refresh functionality for loading new comments.

Comments list with pull & refresh
Comments list with pull & refresh
Adding new comments

A form for adding new comments will be displayed only if the post’s “comment_status” is set to “open”.

The app is responsible for validating data before sending it to the save_comment endpoint. The name and email fields will be treated as required if the post’s “require_name_email” property is set to 1.

The save_comment endpoint will also return error /success messages that can be displayed back to the user after the form has been submitted.

Sharing a post on social networks

The post’s original URL (“link” property from the article’s details) is used for sharing it. This ensures that users visiting the shared link from their desktop devices will be redirected to the correct desktop URL, not to the link from the mobile web application.

The Facebook, Twitter and Google+ share buttons are controlled from the index file of the application, by the following properties:

// Enable Facebook sharing from a post's details page
hasFacebook: true,

// Enable Twitter sharing from a post's details page
hasTwitter: true,

// Enable Google sharing from a post's details page
hasGoogle: true

These settings apply to all posts from the application. The share links are composed as follows:

Social Network Share Link
Twitter{{article_title + ‘ ‘ + article_link}}