We've moved discussions to Discord

How to Use H2, and H3 Header Tags with Action Text?

tommersio
Currently the default Action Text, Rich text editor only seems to support H1 tags for headings which is not ideal for SEO reasons.

What is the best approach for adding support for multiple levels of headings, like H2, H3, H4 for the rich text fields?
William Kennedy
You have to add them yourself in the src/actiontext.js

Here's how I did. I removed the h1 because I didn't need it on this occasion 

Trix.config.blockAttributes.heading = {
    tagName: "h2",
    terminal: true,
    breakOnReturn: true,
    group: false
}

Trix.config.blockAttributes.subHeading = {
    tagName: "h3",
    terminal: true,
    breakOnReturn: true,
    group: false
}



tommersio
Currently the default Action Text, Rich text editor only seems to support H1 tags for headings which is not ideal for SEO reasons.

What is the best approach for adding support for multiple levels of headings, like H2, H3, H4 for the rich text fields?
William Kennedy
You have to add them yourself in the src/actiontext.js

Here's how I did. I removed the h1 because I didn't need it on this occasion 

Trix.config.blockAttributes.heading = {
    tagName: "h2",
    terminal: true,
    breakOnReturn: true,
    group: false
}

Trix.config.blockAttributes.subHeading = {
    tagName: "h3",
    terminal: true,
    breakOnReturn: true,
    group: false
}



Notifications
You’re not receiving notifications from this thread.
© 2022 Jumpstart Pro by GoRails, LLC