For helping the users, giving them information or instructions, ensuring they are in the correct forum, but also for enhancing the SEO capability of every forum page it would be very nice to have the forum description under the title and above the "Add new Forum topic" link possibly as a h2/h3 header.

How can I achieve this?
I could build a new block programmatically for example, but is there any other way without messing with the code?

I have tried token filter module in the hope to use a corresponding token in a custom block but I cannot find any token about the forum/taxonomy description. Actually I don't see a list of available tokens at all.

Could you consider it as feature request for future releases?

Comments

indigoxela's picture

Hi cptX,

to clarify: "every forum page" means /forum/X, not the taxonomy term page (path = /taxonomy/term/X), right.

And also not the forum topic (path = /node/X).

Is that correct?

There's always a solution with Backdrop, as long as you're willing to "think outside of the box".

Hi indigoxela, yes exactly!

One solution is to create a custom block in the layout presented only in forum pages, but with that solution I stack to the bug of not able to use the tokens inside it. Other solution would be to create this block programmatically.

Another and even better solution would be to present the description through the forum page template file, but there is also this action link above so if I present the description above the forum table the action link (add a new topic) will be above the description and doesn't look nice

Maybe the best solution would be to modify the page.tpl.php and present the description under the title...

Not sure yet which path is the best, I'll check the possibilities.

 

I'm searching now for page.tpl.php files but looks like Backdrop works differently. Can you help me understand which files should modify? I cannot find any page.tpl.php file even in the other installed themes...
I have the thesis theme installed now.

Is the layout--boxton--front.tpl.php the file I should modify and check if it is a forum page and print the description?

Update: As I have changed the default presentation of page title and I'm presenting it now through a block this cannot be done through a tpl file. Needs to be done through a block. So can somebody guide me how to create a custom block programmatically?

indigoxela's picture

No fiddling with template files necessary, and no need to write something custom (neither theme nor module), either.

Everything is feasible via UI. but be warned, you'll "dive into views". :-)

The steps:

  1. Create a new view of type "Taxonomy term" (admin/structure/views/add)
  2. It should be a block (not page)
  3. Add a contextual filter "Taxonomy term: Term ID"
  4. When the filter value is NOT available - Provide default value - Raw value from URL
  5. Path component: "2"
  6. Specify validation criteria: Validator - numeric
  7. Action to take if filter value does not validate - hide view

That's the contextual filter, now add a reasonable block description, save.

Now go to either the default layout (admin/structure/layouts/manage/default) or create a new one extra for forums (I can describe the steps, if needed).

Add the views block you just created to the region you prefer, save.

Done!

I'm almost sure, there will be some follow-up questions - that's OK, just ask.

Yes views is an idea. I don't know how overkill is though but at least will be feasible. The question though is are the taxonomy ids the same as the forum ids??? If not then I cannot use the url argument as a taxonomy id. I checked my test site and looks the ids are the same, but is this guaranteed ?

I think after adding several other taxonomies and forums there will be no synchronization between taxonomy and forum ids... Or maybe the taxonomy id is acquired in a relational manner so no issue with it?

indigoxela's picture

My example is just a suggestion. ;-)

It can be set up in less than a minute - I couldn't imagine a quicker and easier solution.

Taxonomy term ID and forum ID are in sync, yes.

Yes, it's a good idea, I'm trying it now. By the way I got this error

Is this a bug??

indigoxela's picture

Is this a bug??

Definitely.

But it's unclear in which module. Something calls a function that doesn't exist. Please open a new forum topic for that - do not mix things here, as it might confuse other readers.

I think this error was produced because I selected this during the view creation

Your idea worked nicely, so I'll keep it. I'm trying replace the <p> tag with the <h3> for the output but it's not working.

These two settings unfortunately don't change anything

Maybe again this is a bug.

indigoxela's picture

Maybe again this is a bug.

No, this time it's not a bug, you have to do it differently:

  1. Revert your Style settings
  2. Use "Rewrite results" instead
  3. Check "Rewrite the output of this field "
  4. As text add: <h3>[description]</h3>
  5. Check "Strip HTML tags"
  6. Preserve certain tags:  <h3>

Done. :-)

Thanks for providing a solution, by playing around I had come to this exact solution before your suggestion, so yes this is the only solution.
Can you please explain why this is not a bug? If I make another field with global text and select "Customize field HTML" it works correctly. But for this taxonomy term description not. Why?

indigoxela's picture

Can you please explain why this is not a bug?

The taxonomy term description is no "regular field", but a pseudo-field. It gets wrapped in a paragraph, and you have to strip that paragraph, so it's valid to wrap it in a heading. Headings may not contain paragraphs.