Open Jimmi08 opened 2 years ago
If you have a minute, can you try the following fix?
$metaDescription = e107::getParser()->toText($row['download_description']);
$metaDescription = e107::getParser()->truncate($metaDescription, 150);
e107::meta('description', $metaDescription);
Actually that doesn't work. @CaMer0n Can you have a look please?
@Moc I believe the issue is that the field was never designed for this this kind of use case. ie. multiple paragraphs of field data, rather than an actual descriptive sentence. Even if the parser did 'work' in this case, the site would be left with misleading meta-descriptions that could have a negative affect on SEO.
Other solutions: a custom plugin to expand the downloads fields with an additional field to store this other data.
Add a meta-description field to the downloads plugin, like we have for news and pages, so that it could be customized (overridden) when needed.
I understand.
I've cleaned up the mess I made but the current situation is not ideal, so I'm leaving this issue open.
Bug Description
The download meta description is generated from the download description, that is TinyMCE field.
Lines are getting to one line for meta description without space between lines... and text is not correctly readable.
Normal description with tinymce used:![image](https://user-images.githubusercontent.com/5429548/152683134-7e175eef-cfa7-47ec-bf9d-8867916b836f.png)
lines are getting together in meta field:
How to Reproduce
Steps to reproduce the behavior:
Expected Behavior
The new line should be replaced by space.
Server Information
PHP 7.4 e107 2.3.1 stable
Additional information
This code is used now:
$tp->text_truncate() is already using $tp->toText() so it is doubled
not sure what should preg_replace do, value is not changed, line breaks are still there...
toText() does this: