New StemQ Features: Link to question page and default tags

in utopian-io •  last month


Pull Request

New Features

Many people are still reading StemQ posts using other Steem apps such as Steempeak or

One point that has been raised on several occasions is that, when reading an answer post, it would be nice to have a link to the original question post.
The StemQ UI facilitates this by presenting a button redirecting the user the original question page.
However other Steem applications are not aware of the relationship between questions and answers and therefore do not offer this facility.
The first feature added by this PR is the insertion of a link to the original question in the answer post.

The second feature that has been added with this PR is the capability for the administrator to configure a list of default tags to be suggested to the user when submitting a new post.
Some people have been confused on whether or not they should specify the #steemstem tag on their StemQ posts and this feature is now used to automatically suggest the #steemstem tag. This tag can be removed by the user if so desired.

StemQ automatic insertion of link to question within answer post


A new feature has been added to StemQ whereby any answer submitted on will have a text notice inserted at the beginning of the post along with a link to the question post.

The notice and the link, while visible on other Steem apps, is automatically removed from the post body when viewing the answer using the StemQ UI.

The code changes extend on the existing feature whereby another StemQ notice is already added at the end of all posts to let people know that an article has been posted through

How was this feature implemented?

Quearn now maintains an array of regular expressions to look for in post bodies. Any string matching these regular expressions is automatically removed from the main text before being rendered on the screen.

A single regular expression is currently inserted into this array when the application start.
This is shown in the code snippet below (this code belongs to the Quearn Quasar plugin code which is invoked at startup):

 axios.get(store.getters['quearn/serverURL'] + '/configs/').then(
    function (response) {
      let config =[0]
      store.commit('quearn/config', config)
      // document.title = config.appName

      store.commit('quearn/removePatterns', new RegExp('\\*\\*' + config.appName + ' [Nn]otice:.*\n*', 'g'))
    function (error) {
      Notify.create('Failed to contact API Server')

So, as can be seen from the above, the regular expression will match any line matching "**<application name> [Nn]otice:" following by empty lines.

For StemQ, this means that all lines matching "StemQ [Nn]otice:" will be removed.

The link to the question is evaluated by the following code:

The code above does two things.
It prepends a StemQ notice at the start of the body, using the i18n translation of the "linktoquestion" text.
It evaluates the URL to the question and substitute the @LINK string with this URL in the notice.

Finally, the code generating HTML from markdown had to be updated to remove all text matching the regular expressions previously mentioned:

Default tags


This feature the administrator to configure a comma separated list of tags which will be automatically offered to the user upon submitting a new post on StemQ.

StemQ uses this feature to offer the #steemstem tag. The user is free to remove this default tag.

How was this feature implemented?
First, a "default_tags" was added to the quearn-server backend Django application.

The ediblog.js script which manages the post submission form has been updated to split this comma separated list and present the corresponding tags in the QChipsInput form field:

GitHub Account

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order: