Jump to content

Page Rename Options


adrian

Recommended Posts

This module allows the page name to change when the title is edited.
 
Modules directory: http://modules.processwire.com/modules/page-rename-options/ 
Github: https://github.com/adrianbj/PageRenameOptions
 
I'd love to think that this module was not necessary for me but, especially during development, I find that page titles often change and I'd really rather have the names/urls match the title. I don't think you can expect clients to remember to change the name when they change the title, or even if they do, they still have to get it right which can be a challenge with a long article names with characters not allowed in page names.
 
With none of the config settings checked, the default behavior is to have the page name always match changes to the page title, but allow the user to manually edit if they want. The options allow you to protect initial differences (changes you may have made as a user with an exempt role), completely disable manual changes, or protect manual name changes from subsequent changes to the title while editing.
 
My preferred settings are to set the exempt role as superuser, and check "Initial Differences Protected" and "Prevent Manual Changes".
 

CONFIG SETTINGS
 
Exempt Roles

  • The selected roles will not be subject to any of the rules below.
  • The name will change automatically with the title, but they will be able to manually edit the page name as desired.
     

Excluded Pages

  • Pages that are excluded from the actions of this module. Changing the titles of selected pages will behave as though this module is not installed. For multi-language sites it is recommended to select the site's homepage.

Initial Differences Protected

  • If checked, further changes to the name (to match a changing title) will not happen if the name is already different from the title (evaluated on page edit initial load)
     

Prevent Manual Changes

  • If checked, it won't be possible to manually edit the name.
  • If checked, this will disable the "Live Changes Protected" setting since it won't be possible to make any manual changes.
     

Live Changes Protected

  • If checked, further changes to the name (to match a changing title) will not happen if the name field was manually changed at any time during the current page edit.
     

Please test the behavior of each setting thoroughly so you understand what each one does!
 
Please let me know if you have any further requirements around permissions / role access to the module's functionality.

Edited by adrian
Update with new config settings
  • Like 12
Link to comment
Share on other sites

Just wanted to mention here that I just made some changes to the config settings that I think give more flexibility, and are hopefully also more logical. I have updated the first post to detail the new options.

If you are running the old version and update to this one, please be sure to revisit the config settings.

Link to comment
Share on other sites

  • 4 weeks later...

Another update today!

I noticed more and more people in the forums are using with the "Disable Settings Tab?" option (available via: $config->advanced = true). With this disabled, and if the "Display 'name' field in content tab?" setting is not enabled, the "Name" field is not available for javascript manipulation when the title is changed.

This update checks for these two settings and if required it will change rename behavior to work on page save instead of instantly via javascript. This alternate method respects the "Initial Differences Protected" setting, but of course the "Prevent Manual Changes" and "Live Changes Protected" options are not relevant since it isn't possible to manually change the page name since the field is not available in the page edit dialog.

This update is therefore only relevant if you are using that "Disable Settings Tab?" option, but if you are and you're using this module, please let me know if you have any problems.

  • Like 2
Link to comment
Share on other sites

One more update - The module now applies its rules during the adding of a new page (not just editing like before). Obviously there is no affect for the "Initial Differences Protected" setting, but all other settings are relevant and now work.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

the module breaks the admin backend of the frontpage here (which has no name!), if "initiial differenes proteced" is on:

This(?):

$(document).ready(function() {

    initialTitleConverted = InputfieldPageName.sanitize($(".InputfieldPageTitle input[type=text]").val());
});
 
causes this error:
ReferenceError: Can't find variable: InputfieldPageName
 
The effect is that all javascript is not working.
Link to comment
Share on other sites

Hi ceberlin,

Thanks for the report - sorry about this - I'll take a look when I am back at my desk in about 10 days.

It might be obvious when I start looking into it, but could you please clarify what "admin backend of the frontpage here" is. What is the path in your browser address bar?

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Hello Adrian

I wanted to try your module, but it seams not to be working. In settings I have left everything blank and unchecked. I am using processwire 2,5,3,  $config->advanced = true and "Display 'name' field in content tab?" is enable. Even so, the page name is not changing when I am updating the title. 

Please help.

Thank you.

Link to comment
Share on other sites

Hi @adrianromega - I have just set up a lightning.pw site running 2.5.3 and everything is working fine at my end. I am just about to PM you the login details. Could you please test at your end and let me know if it works for you.

If it does work, then I think there might be another module causing conflict, although that seems unlikely unless you have some something that also has some JS affecting the live name creation process.

If it doesn't work, then I am guessing a browser issue - what are you running?

Are you getting any JS errors in your console?

  • Like 1
Link to comment
Share on other sites

Just to close out the issue that @adrianromega had - turns out it was simply due to diacritics. Once the characters were added to the replacements section of the InputfieldPageName module settings, everything worked as expected.

Link to comment
Share on other sites

  • 1 month later...

Thank you for this module.

I installed it on a 2.5.28 multi language site and it is not changing page names at all, no matter what aettings I try.

I the module supposed to work in a multi language environment?

Link to comment
Share on other sites

Sorry about that, I never tested in a multi-language environment. I just took a quick look and committed a fix that seems to be working fine here. Could you please try out the new version and let me know if it works for you.

  • Like 2
Link to comment
Share on other sites

  • 5 months later...

I just discovered that after my client had changed the title of the HOME page, the URL for that page got changed accordingly.

Now all pages in the tree got new URLs which is not good for search engine indexing at all.

Maybe you could add an option to disallow automatic changes for the name of the homepage?

Link to comment
Share on other sites

I always set the title/name of the homepage and after that i go to >template>home>fieldsetttings for title and set visibility to locked...so this page name is save.

I do the same for "critical" content pages like news, events, contact....and so on.

regards mr-fan

  • Like 1
Link to comment
Share on other sites

I just discovered that after my client had changed the title of the HOME page, the URL for that page got changed accordingly.

Now all pages in the tree got new URLs which is not good for search engine indexing at all.

Maybe you could add an option to disallow automatic changes for the name of the homepage?

Hi @gebeer - I can certainly add an option like that, but I am curious about the behavior you are seeing - is it a multi-language issue? When I change the title of the homepage, the path to it and all child pages does not change because the name of the home page is never used in the URL.

Maybe I should add a checkbox to the Settings tab of all pages to disable name changes when checked?

  • Like 1
Link to comment
Share on other sites

How to rename "Home" title in the home page instead setting NOT to display "home"? Center area ... Wordpress Themes - WP Forum at BFA ... Oh...then there is the new menu option in WordPress that has more features. --- | --- #

Edited by Martijn Geerts
Removed links (spam)
Link to comment
Share on other sites

@adrian

This seems to be a multilanguage issue. Changing the name of the homepage also changes the path of all children.

Would be great to have checkbox like that.

Thanks for clarifying that. I just committed an updated that adds a new "Excluded Pages" option to the module's config section, so you can add as many pages to this as you want.

Interestingly while testing, I noticed that for non-multilanguage sites you actually have to have the settings tab disabled to even get the name of the homepage to change with this module at all because in most cases it uses JS to change the name and the name field isn't available unless Settings is disabled.

Anyway, please let me know if this new option takes care of things at your end.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

today I was planning to use this module, there are four languages... however one is Greek [home -> pagename == gr], renaming the pagename on the Greek part is causing problems, any suggestion how to exempt the Greek language, or impossible at the moment.

Thx!

Link to comment
Share on other sites

Hi,

today I was planning to use this module, there are four languages... however one is Greek [home -> pagename == gr], renaming the pagename on the Greek part is causing problems, any suggestion how to exempt the Greek language, or impossible at the moment.

Thx!

I don't have the option currently to exempt a particular language, but would be happy to add if that helps. But perhaps the better option would be to figure out a way to prevent the problems you are experiencing when greek is being renamed. Can you provide more details on exactly what is going wrong?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...