Hi @clefler,
The search results display excerpts. And WordPress generates plain text when displaying the excerpt, it will remove all shortcodes and HTML. But some could bypass if it contains malformed content, or other 3rd party plugins is appending some content.
The solution is adding text excerpt manually into your post(s) or page(s).
And since pages, do not have an excerpt by default, you will have to add custom codes into WordPress to be able to insert a page excerpt.
Please go through this link to guide you to do it: https://www.wpbeginner.com/plugins/add-excerpts-to-your-pages-in-wordpress/
Please follow the steps:
-
Add this line to your child theme’s functions.php which adds the excerpt option to your pages.
add_post_type_support( ‘page’, ‘excerpt’ );
-
Edit your page or post and scroll to the very top and click Screen Options, make sure the Excerpt toggled is on
Scroll down and find the Excerpt meta box section and there, add your text excerpt.
Hope it helps.
Thanks