Jump to content

Page Rename Options


adrian

Recommended Posts

Hi,

somehow it seems I've missed this answer... so sorry for the late reply.

ex, this is the title "Συμβουλευτικές υπηρεσίες κατά της διάβρωσης", after renaming the page name ends up in an empty string.

I've disabled the whole pageRename thing, and it's really not high priority, ppl are advised to change the page name manually if applicable.

Kind regards!

Link to comment
Share on other sites

Thanks for the update. But PW doesn't handle creating a page name from that title in the first place - the name stays blank and you have to manually enter a name. If this also what you experience? Sorry, I don't ever use the Multilanguage stuff, so not completely sure how it all works.

The one thing I could probably do would be to not change the name if it would end up blank, but I want to better understand what PW normally does when entering a page title like that.

Link to comment
Share on other sites

No problem, it helps subscribing to this topic :-)

Actually I never thought about that... the Greek came up the fourth language after some time...
When leaving blank, PW creates the same name as the default language. Of course at least two languages have to be present, so in a non-multilingual environment with only e.g. Greek, I really wouldn't know...

In this particular case, the Greek pagename with the default 'English' name became blank after renaming [which makes sense after your comment], so I disabled the module.

Anyway... you're updated :-) and again, nothing to worry about...

[to be filed under "whenever I have some time and I feel like thinking about it, in the year 2026..."] 

Link to comment
Share on other sites

Thanks @videokid for the explanation.

I have just committed an update to the module so that it won't overwrite the name if the result will be empty.

Hopefully this will allow it to work in this multi-language situation.

I appreciate knowing if it now works for you as expected.

I honestly don't know how anyone makes it through the development phase of a large site without this module - I would end up with so many mis-matched titles/names - the editors I deal with never remember to change the name to match. :)

Thanks,

Adrian

Link to comment
Share on other sites

  • 1 month later...

Hi everyone,

Thanks to prompting from a good friend who is doing his first site with PW, I have added the ability to completely lock/prevent changing of the page name.

This is achieved by a new option: "Automatically rename the name field to match the title" - this is checked by default as this is the whole reason this module was created. But now by unchecking this, you can revert to PW's default behavior.

Why not just uninstall once the site is live you ask? Good question :) The reason is that now you can use the "Prevent Manual Changes" options along with this to make it impossible to change the name of the page.

The default PW behavior allows all site editors to change the name - but if you want to prevent this, you can now do it easily.

You can also add superusers (and other roles) to the list of roles that are exempt from the "Prevent Manual Changes" option.

Anyway, hopefully others will find this useful as well.

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

I just added another option to this module that can limit the automatic naming to match the title to only unpublished pages. If the page is published, the name will be left untouched.

This might help out those users who are steadfast in their opinion that the URL to a page should never change - not judging this opinion by the way - it is a very strong argument. 

With this new setting you can change the title multiple times while it's still in unpublished (in draft if you will) and the name will change automatically. Once it is published, changes to the title won't affect the name.

Hope that wins a few more users over :)

  • Like 4
Link to comment
Share on other sites

  • 2 months later...

Hi Adrian,

Nice module. Thanks. I didn't notice it until now. It works properly with my ProcessSetupPageName Module.

One wish: It would be great to have an option (checkbox) to switch from blacklisting to whitelisting for templates.
Meaning switching from 'Exclude Templates' to 'Include Templates' from actions of the module.

Link to comment
Share on other sites

Hi @kixe - glad you're finding it useful.

I have just added Exclude/Include switch that you suggested. The default is exclude to ensure backwards compatibility for those upgrading and not checking anything new in the settings.

Thanks for the suggestion and please let me know if you have any problems.

Also, I have now made the module always ignore the homepage - before I recommended users exclude it on multilanguage sites, but I couldn't think of any reason why it would be needed on any site, so I think this is simpler and cleaner.

  • Like 2
Link to comment
Share on other sites

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

Hi @adrian,

I've started to use you module, it is great when editing in admin, but it is useless when I change the title using the API. According to you code it uses javascript for it, which is good that is reflects the changes immediately. But could you consider checking the name on page save if it matches the title and change it if not (of course respecting the module settings)?

Link to comment
Share on other sites

5 minutes ago, Richard Jedlička said:

but it is useless when I change the title using the API

Actually, it should work for saves via the API as well. At least it used too :) 

This save hook: 
https://github.com/adrianbj/PageRenameOptions/blob/12d18066b89a37fd9a7e05204599b09388bf6f82/PageRenameOptions.module#L117 

should take care of it.

Let me do a little investigating here.

Link to comment
Share on other sites

1 minute ago, Richard Jedlička said:

As I see it's used only when the page has no settings tab, which is not my case. I've tried changing the title using API but it didn't work.

My apologies - you are right :)

I am actually in two minds about supporting this via the API - I wonder if perhaps it should be controlled by an additional module config setting so devs can decide if they want this or not.

I feel like this is something you can do in the API yourself when you change the title? But maybe it would be easier if this module handled any required logic so you didn't have to think about?

Link to comment
Share on other sites

1 minute ago, adrian said:

I am actually in two minds about supporting this via the API - I wonder if perhaps it should be controlled by an additional module config setting so devs can decide if they want this or not.

It would be great :-)

1 minute ago, adrian said:

I feel like this is something you can do in the API yourself when you change the title? But maybe it would be easier if this module handled any required logic so you didn't have to think about?

You, I can handle it myself, but the module handles also the conflicting page names, which is not trivial code.

Link to comment
Share on other sites

Hi everyone,

Thanks to @Richard Jedlička for testing and ideas, there is a new version available.

New features, both off by default:

  • Option to control pages saved via the API - respects all defined settings, just like via the admin GUI.
  • Option to set the name to match the title, even if the title wasn't changed during the current page editing event.

Let me know if you notice any issues with this new version.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

This module now works with the core Page Clone module, so now when you "Copy" a page and edit the title, the name will also change based on the config settings of this module.

I think this is really important, because the current behavior of the clone module will likely result in incorrect names/urls for the new page - I don't think you can rely on site editors to manually edit page names to match titles.

There is currently one issue where it doesn't work for the names of other languages on a multi-language site. I believe this is a bug in the clone module (https://github.com/processwire/processwire-issues/issues/207), but if Ryan says it isn't a bug, then I'll add a workaround in this module.

  • Like 3
Link to comment
Share on other sites

  • 1 month later...

Hello,

Just a quick question. I want to use this module in conjunction with BCE for creating multilanguage pages. Everything works during import except that name is not the good one; so I was searching for alternative to get localized name's page. I succeeded to rename pages as I wanted. However the urls are not modified. I have a green message "PagePath installed, you're protected". I guess I have to de-install this module to get it working. But does it will create other problems? Can I do it only once I finish all my imports and re-install the module after? Does the change will have been permanent?

Thanks
Mel

I'm using PW 3.0.61

Link to comment
Share on other sites

The PagePath module is not affecting what you are seeing - that just records any changes and creates automatic redirects.

As for the "name not being the good one", can you please provide some examples of exactly what you are entering into BCE, the page names you are getting and what you expect/want them to be.

Link to comment
Share on other sites

See screenshots.

In the meantime, I discover that saving the pages solve the problem. However since it's massive import, I will end up to save every pages manually. Can I suggest an addition, maybe, to Admin Actions?

Sélection_168.png

Sélection_167.png

Link to comment
Share on other sites

Sorry @mel47 - I am still not sure exactly what is happening here. I can't see what the title(s) are for that page. BCE should create the names from the entered titles, but of course the support for multi-language is limited to display rather than entry.

It would really help to get a list of exactly what you are doing, in what order, and some examples of the pages you are creating via BCE. Remember that PageRenameOptions is for when you change the title of an existing page - it doesn't really impact newly created pages, which is what I think you are doing with BCE.

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...