Question

I have noticed that text filters placed in the summary area don't seem to work, that the raw text appears in the summary info when posted in Twitter, Facebook and the like.

Is that some inherent problem in the summary area, or is it something like the Metatag filter that sends the unfiltered text directly to Twitter and Facebook?

I will check whether the Metatag output can be filtered in the mean time.

Était-ce utile?

La solution

Text filters should definitely work in the Summary. You can test this by creating a View that uses the formatter "Summary" or "Summary or Trimmed" and using an input format like Plain Text in the Summary. HTML tags should be stripped from your View.

It sounds like something else is at play here.

Edit your Content Type (Structure > Content Types > Your Content Type) and look for the field in question (probably the Body field.)

Make sure Text Processing is set to "Filtered Text (user selects text format)" and the "Summary input" box is checked.

In the "DEFAULT VALUE" fieldset, select the desired Text format (e.g., Full HTML).

EDIT:

I'm sorry, you are correct. The built-in summary is just a summary and it does not support text filters. HTML in that field will be stripped.

This thread on Drupal.org says this won't be fixed until Drupal 9:

https://www.drupal.org/project/drupal/issues/1529188

The workaround is to create a new field called "Summary" and set its text format to the desired WYSIWYG format:

Adding a new Summary field

Then, manage the display of your content type to hide the new field from the Default view mode.

In the Teaser view mode, hide the Body field and show the Summary field instead.

The other solution is to edit the "Filtered HTML" text format to allow the <span> tag and other HTML that you require.

Honestly, it's a bit ridiculous that you have to do this to get what you want. I guess it's just one more reason to look forward to Drupal 9!

Licencié sous: CC-BY-SA avec attribution
Non affilié à drupal.stackexchange
scroll top