 |

tapthevein
Novice
Nov 23, 2006, 1:28 AM
Post #1 of 6
(895 views)
Shortcut
|
|
Create filenames with dashes instead of underscores
|
Can't Post
|
|
Is there anyway to set the default under the field editor for the filename to use dashes instead of underscores? the underscore is VERY search engine unfriendly. Try searching for "Article_Manager" then try "Article-Manager" on Google and you'll see what I mean. Google recognizes the - as a space but doesn't deal well with the _ character.
|
|
|  |
 |

Damon
Staff
/ Moderator

Nov 23, 2006, 11:51 AM
Post #2 of 6
(883 views)
Shortcut
|
|
Re: [tapthevein] Create filenames with dashes instead of underscores
[In reply to]
|
Can't Post
|
|
Hi, There is some javascript in the article admin template that automatically takes the article title, replaces the spaces and invalid characters with underscores and uses that as the article filename. This javascript needs to be edited to instead use dashes. Open the article.html admin template here: /cgi-bin/artman2/templates/admin/menus/article.html Find this code: function replaceInvalidFilenameCharsWithUnderscores(oldFilename) { var newFilename = oldFilename.replace(/[^A-Za-z0-9\-\_]+/g, "_"); newFilename = newFilename.replace(/(^_+|_+$)/g, ""); return newFilename; } Replace with this code: function replaceInvalidFilenameCharsWithUnderscores(oldFilename) { var newFilename = oldFilename.replace(/[^A-Za-z0-9\-\_]+/g, "-"); newFilename = newFilename.replace(/(^-+|-+$)/g, ""); return newFilename; } Save. Upload the template back to your site. Now when you create new articles, spaces will be replaced with dashes: example: this-is-an-example-article.shtml Note: if a future Article Manager version includes an update to this template, you would need to make this quick change again. I hope this helps. If you have any questions, please let me know. Cheers Damon Edis interactivetools.com
|
|
|  |
 |

tapthevein
Novice
Nov 23, 2006, 8:11 PM
Post #3 of 6
(866 views)
Shortcut
|
|
Re: [Damon] Create filenames with dashes instead of underscores
[In reply to]
|
Can't Post
|
|
THANK YOU!!!! That helps me out alot! You ROCK!
|
|
|  |
 |

seize
Novice
Nov 25, 2006, 12:56 AM
Post #4 of 6
(828 views)
Shortcut
|
|
Re: [tapthevein] Create filenames with dashes instead of underscores
[In reply to]
|
Can't Post
|
|
Damon: This may be asking for a bit much, but I'd love to see how I can recreate a neat javascript possibility that AM1 had. I've been futzing around with the old script (from http://www.interactivetools.com/iforum/P48363/) but I've just been ending up with junk – thank goodness for backups! Is there any way to make the filename be created with underscores AND with the a date, preferably in front (20061130-A_Great_headline.shtml or something like that)? I'm guessing that it's not really possible the way that js grabs stuff, but I thought I'd ask. Thanks, Teo
|
|
|  |
 |

MikeB
Staff
/ Moderator

Nov 28, 2006, 3:03 PM
Post #5 of 6
(776 views)
Shortcut
|
|
Re: [seize] Create filenames with dashes instead of underscores
[In reply to]
|
Can't Post
|
|
Hi Teo, Thanks for the post! I've taken a quick look at this and it seems that the JavaScript from Article Manager 1 works in Article Manager 2 with just a couple of quick tweaks. I've attached a copy of the template file I modified(article.html) and after making a back up of the existing file you'll want to upload this onto your server here: /templates/admin/menus/article.html Uploading this file is the easiest method, but if you'd like to know about the specific changes I made, let me know and I can outline these for you. The way this article.html file is set up, you'll end up with filenames in this format: 20061128-Article_Title.shtml I hope this helps Teo, let me know if you have any questions about this! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
Attachments:
|
article.html
(18.2 KB)
|
|
|  |
 |

nigelparry.net
User
Jun 2, 2008, 3:33 PM
Post #6 of 6
(372 views)
Shortcut
|
|
Re: [Damon] Create filenames with dashes instead of underscores
[In reply to]
|
Can't Post
|
|
This was really useful and worked first time. Thanks a lot! _____________________ For more information about Nigel Parry and nigelparry.net websites please see http://nigelparry.net nigelparry.net: award-winning communications solutions for clients with something to say Website & print design Internet, public relations & media consulting
|
|
|  |
|