Proper Tags for Forum Descriptions

  • Affected Version
    WoltLab Suite 5.4
    Affected App
    WoltLab Suite Forum

    In boardNodeList template, forum descriptions are inside in <small> or <p> tags. This will be problematic if the Enable HTML code in forum description option will be checked because <small> and <p> tags cannot contain all other block-level elements.


    Category Description:

    Smarty
    {hascontent}<small>{content}{if $boardNode->getBoard()->descriptionUseHtml}{@$boardNode->getBoard()->description|language}{else}{$boardNode->getBoard()->description|language}{/if}{/content}</small>{/hascontent}


    Forum Description:

    Smarty
    <p class="wbbBoardDescription">{if $boardNode->getBoard()->descriptionUseHtml}{@$boardNode->getBoard()->description|language}{else}{$boardNode->getBoard()->description|language}{/if}</p>


    Here's my suggestion for the proper markup for both.


    Category Description:

    Smarty
    {hascontent}
        {content}
            {if $boardNode->getBoard()->descriptionUseHtml}
                <div>{@$boardNode->getBoard()->description|language}</div>
            {else}
                <small>{$boardNode->getBoard()->description|language}</small>
            {/if}
        {/content}
    {/hascontent}

    Forum Description:

    Smarty
    {if $boardNode->getBoard()->descriptionUseHtml}
        <div class="wbbBoardDescription">{@$boardNode->getBoard()->description|language}</div>
    {else}
        <p class="wbbBoardDescription">{$boardNode->getBoard()->description|language}</p>
    {/if}


    Thanks to PoooMukkel for this issue.

    • Official Post

    There will be no change in 5.4, because this might break CSS selectors that target the <p> itself (standalone or as a compound selector such as p.wbbBoardDescription).

    Alexander Ebert
    Senior Developer WoltLab® GmbH

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!