Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 891 forks source link

Reactify Advanced settings tab #14433

Closed bintzandt closed 4 years ago

bintzandt commented 4 years ago

Explanation

As preparation for the new react modal, we need to reactify components that will be rendered in there. This issue describes how the "Advanced" tab in the metabox should be reactified.

This has been done as clearly as possible, without having to dive too much in the context. If you find any inconsistencies or think that there is a better way, you are free to implement that. Keep it mind though that the design

Technical decisions

Requirements to show the tab

  1. Users need to have the wpseo_edit_advanced_metadata permission in order to have the "Advanced" tab
    WPSEO_Capability_Utils::current_user_can( 'wpseo_edit_advanced_metadata' )
  2. disableadvanced_meta should be false
    WPSEO_Options::get( 'disableadvanced_meta' ) === false

Tasks

Initializing Select2

Note: this is only an example. Please use the correct values and make abstractions where necessary.

import Collapsible from "./SidebarCollapsible";
import { __ } from "@wordpress/i18n";
import { Component } from "@wordpress/element";
class Select2 extends Component {
    componentDidMount() {
        this.select2 = jQuery( "#input-selection" );
        this.select2.select2( { width: "100%" } );
        this.select2.on( "change", e => {
            console.log( e.target.options );
        } );
    }
    render() {
        return (
        `   <select id="input-selection" className="input-selection" name="states[]">
                <option value="AL">Alabama</option>
                <option value="WY">Wyoming</option>
            </select>
        );`
    }
}
class AdvancedSettings extends Component {
    render() {
        return (
            <Collapsible id={ "yoast-cornerstone-collapsible" } title={ __( "Advanced", "wordpress-seo" ) }>
                <Select2 />
            </Collapsible>
        );
    }
}
export default AdvancedSettings;
bintzandt commented 4 years ago

Putting this to blocked because it needs the new components, see https://github.com/Yoast/javascript/issues/550. Picking those up first.

jdevalk commented 4 years ago

Created an Epic for the content team to write the 4 help pages needed for this:

https://yoast.atlassian.net/browse/BP-233

fleurheesen commented 4 years ago

@devteam-reactification The help pages:

  1. Allow Search engines to show this Page in search results? https://yoast.com/show-x-in-search-results/

  2. Should search engines follow links on this page? https://yoast.com/help/should-search-engines-follow-links-on-this-page/

  3. Meta robots advanced https://yoast.com/help/the-meta-robots-advanced-settings/

  4. Canonical URL https://yoast.com/help/canonical-urls-in-wordpress-seo/

jdevalk commented 4 years ago

@IreneStr can you create short links for the team? Not sure what the campaign vars should be.

IreneStr commented 4 years ago

https://yoa.st/allow-search-engines https://yoa.st/follow-links https://yoa.st/meta-robots-advanced https://yoa.st/canonical-url