Boost Posted January 5, 2023 Share Posted January 5, 2023 Hi, Due to SEO, my page titles are somewhat lengthy and are being cropped in the 'Pages -> Tree' menu. Additionally, they are verbose, making it difficult to quickly locate the pages. Is there a plugin that allows me to create an alias for the page title that would only be used in the backend, not the frontend? Cheers Link to comment Share on other sites More sharing options...
zoeck Posted January 5, 2023 Share Posted January 5, 2023 You Can change what Field is Shown inside of the Admin Panel, you can find it in the Modules -> Core -> Page List -> Config It is also possible to change this setting for each template individually, Just Go to your template and Open the Advanced tab, there‘s a config for this ? Just add a „Short Title“ field to your template and Show it in the Page tree… Link to comment Share on other sites More sharing options...
Boost Posted January 5, 2023 Author Share Posted January 5, 2023 30 minutes ago, zoeck said: You Can change what Field is Shown inside of the Admin Panel, you can find it in the Modules -> Core -> Page List -> Config I don't have that. Is it installed by default? Link to comment Share on other sites More sharing options...
Boost Posted January 5, 2023 Author Share Posted January 5, 2023 The place is Modules > Core > ProcessPageList Thanks. 1 Link to comment Share on other sites More sharing options...
bernhard Posted January 5, 2023 Share Posted January 5, 2023 If you are using custom page classes since v206 there is the "getPageListLabel()" method: https://processwire.com/blog/posts/user-activity-v6/#core-updates 1 Link to comment Share on other sites More sharing options...
psy Posted January 5, 2023 Share Posted January 5, 2023 An alternative approach using native PW is to make your titles the shorter version and use a field, eg 'headline' for the lengthy version. In your templates use: <h1><?=$page->get('headline|title')?></h1> This will output the headline if it's available and if not, the title. You can then also use the shorter version in front end menus, etc. In the admin page list, it will default to the shorter 'title' field. If you need the front end page URL to be the longer version for SEO, you could add a hook in templates/ready.php, eg (untested): <?php $wire->addHookBefore('Pages::saved', function(HookEvent $event) { $page = $event->arguments(0); // ensure it meets the requirements if (empty($page->headline) || $page->template !== 'your-template-name') return; // regenerate the page url from the headline field $page->url = wire('sanitizer')->pageName('headline'); // Populate back arguments $event->arguments(0, $page); }); And another way.... In your template, Advanced tab, under "List of fields to display in the Admin Page List", simply enter {name-of-your-shorter-field} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now