sebibu Posted Thursday at 04:45 PM Share Posted Thursday at 04:45 PM I discovered a bug in the pagename generation, see here: https://processwire.com/talk/topic/30444-prepend-date-in-page-name-by-hook-creates-improper-results-on-some-existing-pages/ If there is a final fix, I need to renew / regenerate pagenames out of all pagetitles for all pages of a website. How would you do this? Is there a GUI-way? Or via API with a foreach? With the help of RockMigrations? One pinch: All news pagenames should still be prepended with my hook listed in the forum topic above. Thanks in advance! Link to comment Share on other sites More sharing options...
bernhard Posted Thursday at 05:36 PM Share Posted Thursday at 05:36 PM The hook in the linked thread fires on saveReady, so all you need should be a foreach($pages->find(...) as $p) { $p->save(); echo "Page #$p updated to {$p->name}<br>"; } If you are not dealing with a lot of pages I'd use TracyDebugger's console for that. 1 Link to comment Share on other sites More sharing options...
sebibu Posted Friday at 10:27 PM Author Share Posted Friday at 10:27 PM A very good hint to use TracyDebugger's console for that, @bernhard! Unfortunately in my tests the pagename is not renewed (or new set if empty) out of the pagetitle! foreach($pages->find("template!=admin, has_parent!=2, include=all") as $p) { $p->save(); echo "Page {$page->title} (#$p) updated to {$p->name}<br>"; } Any idea?๐ Link to comment Share on other sites More sharing options...
bernhard Posted 17 hours ago Share Posted 17 hours ago First thing to check is if your hook gets executed. For that put this at the very top of your hook: d('fired'); You should see these dumps in the console output when you foreach() and save() If you don't see it, your hook does not get triggered, which means you found the reason why the page name does not update. Link to comment Share on other sites More sharing options...
sebibu Posted 14 hours ago Author Share Posted 14 hours ago Thanks @bernhard! After shutting down the pc yesterday I got the cause. All pages without news template do not have a saveReady-hook. So for renewing pagenames on pages with other templates I simply have to temporarily create a new hook to set the pagename for other templates, too. Without the prepended news-published-day. Seems to work!โบ๏ธ๐๐โโ๏ธ 1 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