How is the content of the user notification center generated?

  node.js, question

The question is not how the message pushes this piece, but what elegant way to generate the content and links of the message?
For example, message notification in sf.gg

图片描述

How do different message types, content and links piece together after a user performs a certain behavior?
Maybe when push to the message queue, manually piecing together such strings in the code:
"xxx answered your question < a href="xxx">title</a >"
And then shove it in like this? Read it directly from the front end?
If there are many types of messages (comments, replies, private letters, systems, etc.), is there an elegant implementation?

Analyzing and designing from an object-oriented perspective, user, action and URL are passed in different field, which has very good expansibility and little front-end limitation.