Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Editing HTML Code of title in WYSIWYG Post Editor

  • #6213
    Avatar photo[anonymous]

    Hello!

    Is there any way to edit the html source code of the title of a post, the same way you can edit the content of the post in the WYSIWYG Editor?

    I would like to be able to add <br> and <span> tags to the titles of individual posts for further customization inside the post editor, without affecting other posts by editing the template or creating an entire template just for that one post.

    #6257
    Avatar photo[anonymous]

    Hi,

    In fact you can use HTML in the title, but then you have to modify your theme to allow HTML in the title – by default you have:

    {{title}}

    while you need:

    {{{title}}}

    #6303
    Avatar photo[anonymous]
    Tomasz Dziuda wrote:

    Hi,

    In fact you can use HTML in the title, but then you have to modify your theme to allow HTML in the title – by default you have:

    {{title}}

    while you need:

    {{{title}}}

    Thank you for your help Tomasz!

    Changing {{title}} to {{{title}}} does indeed help with adding HTML tags to the title. However, these HTML tags are kept in other parts of the template, such as post navigations and previews.

    For example, if I make the title of a post “My Title: <br><br> My subtitle” and configure {{{title}}} in the post template .hbs file, it will add the breaks on the post page, but on another article, in the “previous article” or “next article” section, the title of this post will be displayed as “My Title: <br><br> My subtitle”.

    If I change the {{title}} in the post navigation to {{{title}}}, it will add a line break in the post navigation. However, I only wanted this styling for the post itself.

    Is there any way to circumvent this? For instance, there’s a section in the Post Setting > SEO options, under “Page Title” that allows you to set a custom post title for the browser tab, which avoids the above issue for browser tabs.

    #6304
    Avatar photo[anonymous]

    I think I’ve solved my own issue. I’m sharing the solution here for anyone it might help:

    I went into the post.hbs file (or whatever custom post file) and removed/commented out the following code at the top:

    <h1>
      {{title}}
    </h1>

    I then went into my post in the post editor and added the title manually, making sure to surround it with h1 tags using the HTML edit button and add whatever styling I want.

    This way, I can style my title however I want in the post itself (inside of the post’s text editor), and it remains unformatted in other sections of my site where the title is used.