I would like to be able to use the meta description in the search results. Often pages on my website have little text (e.g. a contact page, or a page listing publications), and so the first 300 characters of the page look awful when displayed as results.
Currently, I can access the SEO data for the record with {{ record.seo }}, but this regretfully returns unparsed JSON. Is there any way around this (other than, say, using the teaser field and copy+pasting the meta description)?
I'm new to Bolt and low on time at the moment, but fairly proficient with PHP. If a direction was given for me to pursue in implementing it, I might explore it if I have time.
You could add a Twig function/filter to json_decode via an Extension, then you could do something like {{ (record.seo|json_decode).description }} or {{ json_decode(record.seo).description }}.
I would like to be able to use the meta description in the search results. Often pages on my website have little text (e.g. a contact page, or a page listing publications), and so the first 300 characters of the page look awful when displayed as results.
Currently, I can access the SEO data for the record with
{{ record.seo }}
, but this regretfully returns unparsed JSON. Is there any way around this (other than, say, using the teaser field and copy+pasting the meta description)?I'm new to Bolt and low on time at the moment, but fairly proficient with PHP. If a direction was given for me to pursue in implementing it, I might explore it if I have time.