This post doesn't exist anymore!

Where does frog auto-rename breadcrumb and slug?

Feed 6 posts, 3 voices

Avatar
184 posts

I’m trying to find where Frog renames the Breadcrumb and Slug fields when renaming the title field, in hope to create a variable that would allow me to switch this on or off (maybe even create a plugin).

At present, I have internal staff doing some SEO changes to a website I have built before it goes live and this auto-renaming is breaking certain aspects of the site, which I have coded to expect either the Breadcrumb or Slug value as a unique page identifier.

I was sure this has previously been discussed somewhere, but I have been unable to find anything. If anyone knows, I would really appreciate it.

Thanks.

 
Avatar
24 posts

Click on the Metadata tab when editing a page?

 
Avatar
184 posts

I found it: /admin/javascripts/frog.js

when('page_title', function(title) {
    var slug = $('page_slug'),
        breadcrumb = $('page_breadcrumb'),
        oldTitle = title.value;    
    if (!slug || !breadcrumb) return;    
    new Form.Element.Observer(title, 0.15, function() {
      if (oldTitle.toSlug() == slug.value) slug.value = title.value.toSlug();
      if (oldTitle == breadcrumb.value) breadcrumb.value = title.value;
      oldTitle = title.value;
    });
});
 
Avatar
1 posts

I modified this script below:

when('page_title', function(title) {
    var slug = $('page_slug'),
        breadcrumb = $('page_breadcrumb'),
        oldTitle = title.value;		
    if (!slug || !breadcrumb) return;    
    new Form.Element.Observer(title, 0.15, function() {
	  var newSlug = "date" + new Date().getTime().toString();
	  if (slug.value == "") slug.value = newSlug;
      if (oldTitle == breadcrumb.value) breadcrumb.value = title.value;
      oldTitle = title.value;
    });
  });

When you create a new page, it will detect slug is empty or not, if the slug’s value is empty it will append a timestamp to replace empty slug.