How to create the new page without using the SMT and router in the extension

we can achieve this by adding the following code in the extension.

<!-- wp:code -->
<pre class="wp-block-code"><code>define(
    'JJ.Custome_prodectes.CustomeProdectes', [
        'JJ.Custome_prodectes.CustomeProdectes.View'
    ],
    function(
        CustomeProdectesView
    ) {
        'use strict';

        return {
            mountToApp: function mountToApp(container) {
              
                var layout = container.getComponent('Layout');

                if (layout) {
                    layout.addChildView('CustomeProdectes', function() {
                        return new CustomeProdectesView({ container: container });
                    });
                    var pageType = container.getComponent('PageType');

                    pageType.registerPageType({
                        name: 'CustomeProdectes',
                        routes: ['CustomeProdectes'],
                        view: CustomeProdectesView,
                        defaultTemplate: {
                            name: 'jj_custome_prodectes_customeprodectes.tpl',
                            displayName: 'CustomeProdectes default',
                          
                        }
                    });
                }

            }
        };
    });</code></pre>
<!-- /wp:code -->

Leave a comment

Your email address will not be published. Required fields are marked *