The SEO Framework was initially named AutoDescription because its sole purpose was generating descriptions.
Since its inception, we wanted to uphold that name. Moreover, we don’t want you to spend hours on SEO, that’s wherefore our plugin is. So, we’ve developed and integrated symbolic and logical interpretation AI that works with every language you throw at it. It is intelligent: we can’t anticipate what you are going to write, but we know that any description that comes out is excellent. It is better than what Google can generate, so keep that option enabled!
Of course, this is assuming you write accordingly: Introduction – Context – Conclusion.
As of TSF v4.0.0, the generator works like described below. For the sake of simplicity, we’re describing how it generates descriptions for posts and pages only.
The generator works in three sequences:
- The getter obtains the content information;
- The parser converts what the getter obtained to a description;
- The renderer formulates the parsed content into a safe and usable string.
Step one, the getter:
- first takes your content (or excerpt, when available);
- strips sole link paragraphs (often used for Twitter and Youtube embeds);
- strips all shortcodes, which is why page builders don’t work with this;
- strips all headers, images, scripts, lists, forms, etc. (i.e. non-canonical and non-sentence content);
- replaces all leftover HTML tags with spaces;
- converts the content into a single line;
- converts non-break spaces and tabs to spaces;
- converts reverse solidus (
- converts sequential spaces to single spaces;
Now, we have clean and workable content for our parser.
Step two, the parser:
- converts all HTML entities to human-readable entities (
& → &);
- trims all spaces around the content;
- takes a number of characters from the start of the content, excluding the last word or punctuation on that boundary:
- for Open Graph descriptions, it’s 200 characters;
- for Twitter descriptions, it’s 200 characters;
- for meta descriptions, it depends on the WordPress language set:
- 148 characters for Assamese (অসমীয়া);
- 158 characters for German (Österreichisch Deutsch, Schweiz Deutsch, & Deutsch);
- 148 characters for Gujarati (ગુજરાતી);
- 100 characters for Malayalam (മലയാളം);
- 70 characters for Japanese (日本語);
- 82 characters for Korean (한국어);
- 120 characters for Tamil (தமிழ்);
- 70 characters for Chinese (繁體中文, 香港中文版, & 简体中文);
- 160 characters for all other languages.
- trims all spaces around that content. If there’s nothing left, the parser stops here;
- tries to ignore all leading punctuation, and breaks up the content into six parts. The last parts consist of the leading words after the last punctuation character:
- If there are more than three leading words, it uses the complete sentence.
- If there are fewer than three leading words, it trims those words.
- If there are no words after the last punctuation character, it does nothing.
- trims all leading whitepaces and commas;
- does either one of two things:
- When the last character is a
;, it strips all leading punctuation and whitespace, and replaces that with a single dot;
- When it finds no punctuation, it adds
…in the renderer).
- When the last character is a
- finally removes all surrounding whitespaces.
Now we are left with your description, or we have nothing at all. Because we may add symbols to make sentences or inviting content, it can consist of more characters than we would typically recommend.
Step three, the renderer:
- texturizes the description (converting
…, transforming quote tags, etc.);
- converts HTML tags to readable HTML, so no intended tags are lost. E.g.,
- removes all leftover HTML (for secure display, just in case);
- converts “Wordpress” to “WordPress”, so to keep Mr. Mullenweg happy;
- finally trims all spaces.
Now we have secure content that can be used anywhere on your site. For a final secure touch-up, we escape the description for the meta tag’s attribute output.
It’s almost perfect, but not quite
For now, PHP is a single-threaded scripting language, and this means it can only do one thing at a time. We don’t want your site visitors to wait for a hidden tag to load, so we are strict and careful about what we use. It is why our software is performant, and why it takes months to release updates.
With that, the description generator is almost perfect, but not quite. For example, our generator isn’t aware of your intent, nor does it calculate the pixels used. So, if you want to make it perfect, consider if you have the time to do so, and fill in the meta tag yourself. The people we work with don’t have that time, and so we made this plugin.