onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

P#54045 Meta title and description for detail view #223

Closed jmaas-onoffice closed 1 year ago

jmaas-onoffice commented 2 years ago

Userstory

As a website visitor I want to share an estate with a friend. I want the link preview in Facebook to work.

Current state

Only the <title> tag is set.

Even when the detail page is not indexed by search engines, the description is still important for showing link previews on e.g. Facebook.

Desired state

1. Modes

  1. The plugin offers two modes: It can fill out the HTML title and description itself (see 2)), or it can offer compatibility with SEO plugins and leave them untouched but offer custom fields (see 4)).
  2. The option to fill out the HTML title and description is active by default.
  3. These options are placed in the plugin settings. The existing heading "Google Bot" (see current screenshot) is renamed to "SEO" and the new options are added below that labeled "Title and Description".

    settings_current

    There are two radio buttons, one for each option, with explanations. In the description of the compatibility mode there is a <details> element which contains more information on the custom fields. The <details> is opened in the screenshot so that you can see its content, but it should be closed by default. (The content of the <details> is from a previous version. The current text is below.)

    settings_desired

    Text:

    The title and description of the detail page are set using the and <meta name="description"> tags. They make it possible to show a summary of the page when you share a link.</p> <ul> <li>Fill out This plugin will fill out the title and description with the information from the estate that is shown. This option is recommended if you are not using a SEO plugin.</li> <li> <p>Do not modify This plugin will not modify the title and description. This enables other plugins to manage those tags.</p> <p>Custom fields When this option is active, you can use special custom fields to use data from onOffice enterprise in your SEO plugins. To display the property number (fieldname <code>objektnr_extern</code>) and title (fieldname <code>objekttitel</code>) of the current estate in the detail page's title, you can use the custom fields <code>onoffice_objektnr_extern</code> and <code>onoffice_objekttitel</code>. For information on how to use custom fields consult you SEO plugin's documentation.</p> <p>To find out the fieldname of a field, look in the detail page's field list. When you expand a field, it shows you the "Key of Field" which you should put behind <code>onoffice_</code> to form the custom field name. You can use any field that you have added to the estate field list on the right of the detail page.</p> <p>If you need to shorten a field to e.g. 50 characters, you can use <code>onoffice_ellipsis50_objektbeschreibung</code>. This will shorten the estate's description to 50 characters, including the ellipsis, so that the description may look like "This is a description that is shortened to 50…". To display up to 150 characters, you can use <code>onoffice_ellipsis150_objektbeschreibung</code>.</p> </li> </ul> </blockquote> </li> </ol> <h2>2. Fill out</h2> <ol> <li>If the option "Fill out" is active, the plugin ensures that the estate detail page contains <code><title></code> and <code><meta name="description"></code> tags containing the estate's title and description. The title is the full-length content of the field <code>objekttitel</code>. The description is the full-length content of the field <code>objektbeschreibung</code>.</li> </ol> <h2>3. SEO plugin check</h2> <ol> <li> <p>If the option "Fill out" is active, the plugin checks if popular SEO plugins are active. It should check for the plugins Yoast SEO, Rank Math SEO, and wpSEO. One way to check for this is <code>count(array_intersect( ["wordpress-seo/wp-seo.php", "seo-by-rank-math/rank-math.php", "wpseo/wpseo.php"], get_option("active_plugins"))) > 0</code>. If one of these plugins is found to be active, we consider it to be a "conflict".</p> </li> <li> <p>If a conflict was detected, our plugin displays a warning using <code>admin_notice</code> (<a rel="noreferrer nofollow" target="_blank" href="https://developer.wordpress.org/reference/hooks/admin_notices/">https://developer.wordpress.org/reference/hooks/admin_notices/</a>) in the style <code>notice-warning</code> containing the name of the conflicting SEO plugin and a link to the detail page settings.</p> <p><img referrerpolicy="no-referrer" src="https://user-images.githubusercontent.com/90763364/164718486-bfe2d613-b361-47f3-83ca-ec819f7bf0dc.png" alt="general-warning_desired" /></p> <p>Text:</p> <blockquote> <p>The onOffice plugin has detected an active SEO plugin: Yoast SEO. You currently have configured the onOffice plugin to fill out the title and description of the detail page, which can lead to conflicts with the SEO plugin. We recommend that you go the the onOffice plugin settings and configure the onOffice plugin to not modify the title and description. This allows you to manage the title and description with your active SEO plugin.</p> </blockquote> </li> <li> <p>The warning should be displayed as soon as possible (e.g. directly after a SEO plugin was activated). It should be shown as long as the conflict persists (until the SEO plugin is deactivated or our plugin configured to not change the title and description) or until the user dismisses the warning by clicking on the "x". If the user dismissed the warning and now changes the setting to "Do not modify" and then back to "Fill out", the warning should appear again.</p> </li> <li> <p>The warning should be shown on all pages of the admin, so that the user cannot miss it. The only exception is that in the plugin settings, the warning is displayed near the new option.</p> <p><img referrerpolicy="no-referrer" src="https://user-images.githubusercontent.com/90763364/164718536-f571ce02-42b7-45d0-bf7b-deab41adbb30.png" alt="settings-warning_desired" /></p> <p>Text for warning on settings:</p> <blockquote> <p>We have detected an active SEO plugin: Yoast SEO. This option can lead to conflicts with the SEO plugin. We recommend that you configure the onOffice plugin to not modify the title and description.</p> </blockquote> </li> </ol> <h2>4. Do not modify</h2> <ol> <li>If the option "Do not modify" is selected, the plugin does not modify the <code><title></code> and <code><meta name="description"></code> tags, in order to prevent conflicts with SEO plugins. Instead, it registers custom fields so that those SEO plugins have access to the information of the current estate. There is a hook available that allows to provide these custom fields on demand called <code>get_post_metadata</code> (<a rel="noreferrer nofollow" target="_blank" href="https://developer.wordpress.org/reference/hooks/get_meta_type_metadata/">https://developer.wordpress.org/reference/hooks/get_meta_type_metadata/</a>).</li> <li>When a custom field is requested, the plugin should return the value of the corresponding estate field. Address fields from the contact person are not available. The corresponding field is the part after the <code>onoffice_</code> prefix. For <code>onoffice_objekttitel</code> it is <code>objekttitel</code> and for <code>onoffice_objektnr_extern</code> it is <code>objektnr_extern</code>.</li> <li> <p>Additionally, there is a need to restrict the length of some fields. For example, most SEO tools warn when the description is over 150 characters (including the ellipsis). Therefore, the custom field name should be able to contain a parameter for restricting the length, e.g. <code>onoffice_ellipsis150_objektbeschreibung</code>.</p> <ol> <li>The syntax is <code>onoffice[_ellipsis<characters>]_<fieldname></code>. So <code>onoffice_objektbeschreibung</code> returns the full description, <code>onoffice_ellipsis1000_objektbeschreibung</code> would limit the description to 1000 characters, and <code>onoffice_ellipsis5_objekttitel</code> returns the title limited to 5 characters including the ellipsis, e.g. "I am…", since <code>…</code> is a single character.</li> <li>The string should not get cut off in the middle of a word. It should get cut off at the last whitespace before reaching the limit. For example if "I am tooooooo long" with a limit of 8 should not be output as "I am to…", but as "I am…".</li> </ol> </li> </ol> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jmaas-onoffice"><img src="https://avatars.githubusercontent.com/u/90763364?v=4" />jmaas-onoffice</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Modifications:</p> <ul> <li>Changed the fixed custom field list to a pattern which allows any estate field to be used via a custom field.</li> <li>Updated the explanation about the custom fields to reflect this change.</li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jmaas-onoffice"><img src="https://avatars.githubusercontent.com/u/90763364?v=4" />jmaas-onoffice</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Additions:</p> <ul> <li>4.3 is a mechanism for restricting the length for fields.</li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jmaas-onoffice"><img src="https://avatars.githubusercontent.com/u/90763364?v=4" />jmaas-onoffice</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <ul> <li>Updated description for user in 1.3 to explain shortening.</li> <li>Changed the syntax due to Yoast and the shortening to not split a word in 4.3.</li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/LongTrong-exe"><img src="https://avatars.githubusercontent.com/u/101325858?v=4" />LongTrong-exe</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>@jmaas-onoffice <img src="https://user-images.githubusercontent.com/101325858/184285603-034bdbd8-858b-4f71-8d51-57ff3ccfac12.png" alt="image" /> When the user selects "Fill out", dismiss the warning and change setting to "Do not modify", then them select "Fill out" again. Should the warning be displayed again?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jmaas-onoffice"><img src="https://avatars.githubusercontent.com/u/90763364?v=4" />jmaas-onoffice</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>@LongTrong-exe Good question! I think it's best to show the warning again. They can still dismiss it. I've updated the requirements. 👍 </p> <p>Thanks!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/hungnc89"><img src="https://avatars.githubusercontent.com/u/72601287?v=4" />hungnc89</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>@jmaas-onoffice have you any feedback for this task ?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jmaas-onoffice"><img src="https://avatars.githubusercontent.com/u/90763364?v=4" />jmaas-onoffice</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>@hungnc89 Yes, I'm reviewing the PRs in order of priority, that's why it's taking some time... But I just reviewed the corresponding PR.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>