Inserting auto-title attributes and common tags in Redactor
Permalink
So this question began with me noticing Redactor doesn't, by default, include a title tag on links to pages and files.
I wanted to see if anyone has an override fix for this, preferably via an /applications/bootstrap/app.php override
I think that'd be the best way, but open to anyone's suggestions on how to enable auto-title tags so when I link to a page or file, Redactor also includes the title attribute with the Page or File title populating it's title attribute.
Segue that into the <abbr> tag. My company has a very common abbreviation for our name. For example, let's say my company name is National Biscuit Company, but everywhere on our site and in the world, folks call us NABISCO.
For both SEO and inclusion/accessibity purposes, our policy is to use the proper HTML abbr tag to define both and by extension, show in related search results for either term.
Also worth noting, I've came to the realization that often times, the abbreviation definition contains very valuable keywords you want to have on your site, helping to net users in google who may know those words, but do not know you or your abbreviation. And it's very handy for all users, a simple CSS cursor:help; setting and a light dotted underline styling goes a long way to informing users who are unfamiliar with your abbreviated jargon, giving the ability to get the definition in a nice little title tag on hover. I believe the <abbr> tag is the little tag that could. It goes a long way for assuring google/search engines AND users of the quality, authority, and trust-worthiness of your site.
Anyways, back to the main question.
I'm wondering if Redactor can be set to automatically replace "NABISCO" found anywhere in the content with "<abbr title="National Biscuit Company">NABISCO</abbr>" site-wide.
Any ideas?
Or is this something c5 itself would be better?
Thanks in advance!
Pat.
I wanted to see if anyone has an override fix for this, preferably via an /applications/bootstrap/app.php override
I think that'd be the best way, but open to anyone's suggestions on how to enable auto-title tags so when I link to a page or file, Redactor also includes the title attribute with the Page or File title populating it's title attribute.
Segue that into the <abbr> tag. My company has a very common abbreviation for our name. For example, let's say my company name is National Biscuit Company, but everywhere on our site and in the world, folks call us NABISCO.
For both SEO and inclusion/accessibity purposes, our policy is to use the proper HTML abbr tag to define both and by extension, show in related search results for either term.
<abbr title="National Biscuit Company">NABISCO</abbr>
Also worth noting, I've came to the realization that often times, the abbreviation definition contains very valuable keywords you want to have on your site, helping to net users in google who may know those words, but do not know you or your abbreviation. And it's very handy for all users, a simple CSS cursor:help; setting and a light dotted underline styling goes a long way to informing users who are unfamiliar with your abbreviated jargon, giving the ability to get the definition in a nice little title tag on hover. I believe the <abbr> tag is the little tag that could. It goes a long way for assuring google/search engines AND users of the quality, authority, and trust-worthiness of your site.
Anyways, back to the main question.
I'm wondering if Redactor can be set to automatically replace "NABISCO" found anywhere in the content with "<abbr title="National Biscuit Company">NABISCO</abbr>" site-wide.
Any ideas?
Or is this something c5 itself would be better?
Thanks in advance!
Pat.
Thanks MrK
Yeah, took a look and I was on c5.7.5.10 (eek!).
c5 been pushing some killer updates hot and heavy hear lately.
Super excited about both CKEditor.
And this PHP function made me drool.
Thanks so much!
> On Dec 15, 2016, at 6:44 PM, concrete5 Community <discussions@concretecms.com> wrote:
Yeah, took a look and I was on c5.7.5.10 (eek!).
c5 been pushing some killer updates hot and heavy hear lately.
Super excited about both CKEditor.
And this PHP function made me drool.
Thanks so much!
> On Dec 15, 2016, at 6:44 PM, concrete5 Community <discussions@concretecms.com> wrote:
Regarding your first question, concrete5 version 8 uses CKEditor as the default rich text editor and includes a field for entering link titles (the Advisory Title field).
I think one approach to your second question would be using a custom template for the Content block. In the custom template you could use the PHP function str_replace() to look for "NABISCO" and replace it with "<abbr title="National Biscuit Company">NABISCO</abbr>".
Example:
application\blocks\content\templates\content_replace.php
The custom template could be made the default view using the getThemeDefaultBlockTemplates() method in your theme page_theme.php.
Example:
Newly created Content blocks would use the "Content Replace" custom template by default. Existing Content blocks would not, so this would be something to do at the beginning of development. The other option would be to override the Content block view.php, adding the str_replace() to the default view for all Content blocks.