extractText
provides the pure-text version of those Obj
’s attributes that are specified as extractTextAttributes
in its model class. To achieve this, the function removes HTML tags and newlines from the attribute values. Here are some use cases:
- Displaying a preview snippet, for example the first 300 characters of a
- page in a search results list,
- blog post in a blog post overview,
- text preview of a PDF file (e.g. in a search results list).
- Providing metadata for a page, for example by
-
using extracted text in
og:description
ortwitter:description
meta tags in the header -
using widgets as a content source in a Schema.org
JobPosting
. - Calculating the estimated reading time of a blog post based on the word count.