Add two fields in NodeBB
-
Now in NodeBB there are many useful things. I have a suggestion that will be useful to many. I'm ready to do it all himself. Requires only the consent of the developers.
To solve my problem requires two additional fields in category management page and template category:
meta description
andcontent
.If
meta description
field filled it will be inserted in the html tag template category, if not will be entered default fielddescription
.content
field will be used at the top of the template category, before the breadcrumbs and will contain anything: h1, image, description...
On the edit page, the category will be the area to edit the text of this field in the format markdown.These fields are not mandatory and I will try to do so that they are compact and convenient location.
-
It would be good to add more :
h1
,title
,meta keywords
-
And in the template category used h2 in items subcategories and topics.
-
Well even make it possible to insert special tags such as
\{name\}
, but I think this will be no problem. -
Sounds good to me, looking forward to the PR
-
\{description\}
does not appear when you click on links in category template, but only if the next time you refresh the page , this text is displayed. It's hard to decide? -
I did almost everything , remains connected to the markdown to the field
content
-
Something in the string not correctly in the file
src/middleware/middleware.js
:if (res.locals.isAPI) { return res.json(options); }
-
Sorry, I didn't understand the last thing that you said?
-
@psychobunny Please see the line 320 in the file. Try to get in the console:
console.log (res.locals.isAPI)
.
If reload category page:undefined
If back and next to the category page:true
-
Yeah that makes sense. So how NodeBB works is we have rendering on both client-side and server side. This is for maximum SEO potential, ability to render on JS-disabled browsers, and just plain speed.
So in that middleware, we check if you're cold-loading (thus isAPI is not set) or if you're requesting just the data for the page from ajaxification (isAPI is set). Basically if isAPI is not set we render the whole thing on server with the header and footer and send it over to client.
-
@psychobunny What should I do to make it work in the template category?:
<!-- IF content --> <div class="content"> \{content\} </div> <!-- ENDIF content -->
-
@psychobunny said:
Sorry, I didn't understand the last thing that you said?
I need to worked in the template
\{content\}
. Now it works, but only after refreshing the page. -
@psychobunny I realized what was happening. This issue is relevant only in conjunction to one's options my browser probably sessions or cookies, I try to understand.
-
But there is another problem. If this sub-category, and if do not set
content
her, in tag\{content\}
is substituted\{parent.content\}
. I can not find where to fix it. -
With
\{description\}
everything is fine. -
Can be removed
validator.escape()
from the line 166src/categories.js
file? -
@sergej-saveljev said:
But there is another problem. If this sub-category, and if do not set
content
her, in tag\{content\}
is substituted\{parent.content\}
. I can not find where to fix it.I solved the problem by adding the file
src/categories.js
line:if (!category.content) category.content = false;
-
Please tell me what to do, that be can use the template categories.tpl (ie on the main page) tag
\{content\}
?
-
I try to understand, but was be interesting to hear the views of developers.