CMS Development

Efflamm
Member

Disable inline style in blog content editor tool

Hi,

I'm working on a website with a blog and my client wants to have a similar design in all blog posts ( Ex: blue links with underline on hover, same font everywhere,... )
BUT there's many authors that force their own style with the editor tool and even when they want, they can't remove the inline style easily.

Is there a way to disable styles in blog editors tool so the stylesheets of my theme and templates will work proprely ?

styling toolsstyling tools

 

screenshot.png

 



Here is an exemple of junk style I see everywhere.
I removed text inside for privacy.

<p style="text-align: left;"><strong></strong></p>
<ul style="font-size: 18px;">
<li style="text-align: left;"><a href="#" rel=" noopener" style="font-weight: normal;"></a></li>
<li style="text-align: left;"><a href="#" rel=" noopener" style="font-weight: normal;"></a></li>
<li style="text-align: left;"><a href="#" rel=" noopener" style="font-weight: normal;"></a><span style="font-weight: normal;">?</span></li>
</ul>
<p><span style="font-size: 12.0pt; color: black;"> <img src="#" style="display: block; margin-left: auto; margin-right: auto;"></span></p>
<p><a href="#"style="text-decoration: none;"><span style="font-size: 12pt;"></span></a><span style="font-size: 12pt;"></span></p>
<p><span style="text-decoration: none;"><span style="font-size: 12pt;"></span></span></p>
<p><span style="text-decoration: none;"><span style="font-size: 12pt;">&nbsp;</span><span style="font-size: 12pt;">“</span></span></p>
<p style="margin-top: 0mm; margin-right: 0mm; margin-bottom: 0mm; padding-left: 0mm;"></p>

0 Upvotes
5 Replies 5
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Disable inline style in blog content editor tool

For discussion purposes and playing devils advocate here…and opinion dump FYI…

 

We run into this issue all the time with our team members.

 

I think it's managements responsibility to setup the team with the correct tools i.e. style guides and training to do their job to the level expected. Additionally it should be expected and communicated that it is an employees job to learn, understand, and apply a style guide appropriately; be it design, copywriting, or anything thing really.

 

Personally I don't see this issue as being any different from an office's code of conduct and policies.

 

To cap all of my opinions off (lol):

If you're company owns the application of branding and the style guide, the guide should be a living document. This document should also outline a process for amendments. Usually displayed as a flow chart. I had an amazing example of this a few years back, if I can find it i'll add it!

 

Now if this is implemented and agile the authors may need the ability to change styling manually to adhere to the style guide. If the system prevents this agility then you start to run into scalability issues, not to mention potentially insulting your authors intelligence.

 

but………

If the intention is to keep complete control at a higher level, management intends to work within the limitations that are presented well you're golden!

 

TL;DR

Ensure that an understanding of the potential limitations of either option is taken into account when deciding on a blanket solution like this.

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
dennisedson
HubSpot Product Team
HubSpot Product Team

Disable inline style in blog content editor tool

So everyone can upvote the idea, here is the link

 

0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Disable inline style in blog content editor tool

Hey @Efflamm 

You could use the regex_replace filter in your blog template!

 

{% set html = '<div style="color:red">
  <p style="background:green">
    Hello, World!
  </p>
</div>' %}

{{ html|regex_replace('style="[^\"]*"',"") }}

 

 

@dennisedson I had no idea this article existed or funcitonality! This will be a big help!

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
dennisedson
HubSpot Product Team
HubSpot Product Team

Disable inline style in blog content editor tool

Hey @Efflamm , it would be great if you submitted an idea for this!  

Send a link to the idea so we can upvote it

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Disable inline style in blog content editor tool

hello @Efflamm 

The bane that is the rich text editor (insert appropriate gif here)

If you are developing locally, you can "disable" features of the RTE.

This article walks through it.  You would need to use a custom module rather than the default blog RTE.

That is about the best you will be able to do at limiting the RTE at the moment.

 

Good luck reigning in the copywriters!