• Gear
  • Shots
  • Photo Craft
  • Video
  • Wide Angle
  • Support
  • New Stuff
  • More
Support SmugMug Customization Updated Vanity URLs

FAQtoid

Ever wanted to create an Avatar? Creating an Avatar!

Searching Dgrin with Google Searching with Google

Dgrin Challenges

Congratulations to the Winner of DSS #128 (Sunrise or Sunset), ShootingStar.

The next Dgrin Challenge DSS #129 (Silhouette Revisited ) is open for entries through May 27th, 2013 at 8:00pm PDT.

As always, we look forward to your participation but please do take a moment to read through the rules before posting your entry.

Past DSS Challenge Winners, DSS Challenge Rules, and other important DSS Challenge information is here.

Need some help with Accessories?

Tutorials

Ever find yourself wondering just how someone managed to create an image using different effects?

Here are three simple tutorials we hope will encourage you to try something new.

The Hot Seat

A lifelong interest in landscape photography has led Eyal Oren to make a study of his adopted hometown of Marblehead, MA. As you can see, his dedication is paying off!

Africa!

Dgrinners Harryb, Pathfinder, and others joined Andy Williams and Marc Muench on Safari in East Africa recently. Here are some awesome threads to check out!

 
Thread Tools Display Modes
Page 12  of  12
« First 2 8 9 10 11 12
Old Apr-08-2012, 06:12 AM
#221
youngturk is offline youngturk
Beginner grinner
Quote:
Originally Posted by jfriend View Post
You set up a vanity URL to take the user to http://tourmaster.smugmug.com/RAD and there are no public galleries in that category. If you have galleries in that category, then you will have to make them public to allow them to display in that category. If you are trying to show a group of unlisted galleries, then you may need to use a sharegroup and set the vanity URL to point to the sharegroup. A sharegroup can show unlisted galleries - a category cannot.
A-hah... Now I see. I was trying to follow the suggestion listed here in post #2 by devbobo and I thought the instructions at the top of this thread included setting up a sharegroup. Now, thanks to you, I realize it did not so I will go do that right now and see if it fixes my problem. Thank you for pointing out my mistake!
Old Apr-08-2012, 06:33 AM
#222
youngturk is offline youngturk
Beginner grinner
Quote:
Originally Posted by jfriend View Post
You set up a vanity URL to take the user to http://tourmaster.smugmug.com/RAD and there are no public galleries in that category. If you have galleries in that category, then you will have to make them public to allow them to display in that category. If you are trying to show a group of unlisted galleries, then you may need to use a sharegroup and set the vanity URL to point to the sharegroup. A sharegroup can show unlisted galleries - a category cannot.
Yep, that fixed it! THANK YOU for your help. I really appreciate it. Now, in addition to vanity URLs I also know how to set up sharegroups which opens up new possibilities for customization.

Again, THANK YOU for your quick expert help.

John
Old May-11-2012, 12:54 PM
#223
Ahtz is offline Ahtz
Beginner grinner
I got it to work for a specific gallery but it doesn't seem to be working for an event page or the "guest upload" link (recent new feature). Am I doing something wrong or is that not possible?
Old May-11-2012, 01:06 PM
#224
jfriend is offline jfriend OP
Scripting dude-volunteer
Quote:
Originally Posted by Ahtz View Post
I got it to work for a specific gallery but it doesn't seem to be working for an event page or the "guest upload" link (recent new feature). Am I doing something wrong or is that not possible?
If you post a link to your site and provide the vanity URLs that aren't working, we can take a look. Can't do much without being able to look at your specific URLs.
__________________
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
Old May-11-2012, 01:30 PM
#225
Ahtz is offline Ahtz
Beginner grinner
my website is www.jasonallenimages.com

These are the three i'm testing it out with:
"britjohnguest" : "http://www.smugmug.com/photos/guest/HGWBQm/BarkowGuest",
"britjohnwedding" : "http://www.jasonallenimages.com/event/barkow/gL0dBjf0tec02",
"britjohnguestgal" : "http://www.jasonallenimages.com/2012Weddings/Barkow/Guest-Photos/22862163_HGWBQm"

one is an event page, one is a specific gallery, and one is the link that takes guests to the upload page (this is that new feature just released)

The gallery page works but the others don't.

Here is my top javascript:



Quote:
/*VANITY URL*/

var vanityTable =
{
"britjohnguest" : "http://www.smugmug.com/photos/guest/HGWBQm/BarkowGuest",
"britjohnwedding" : "http://www.jasonallenimages.com/event/barkow/gL0dBjf0tec02",
"britjohnguestgal" : "http://www.jasonallenimages.com/2012Weddings/Barkow/Guest-Photos/22862163_HGWBQm"

};

// Vanity URLs code version 1.2
function CheckRedirects() {
if (YD.hasClass(document.body, 'homepage') || YD.hasClass(document.body, 'category')) {
// get the path from the current URL,
// convert it to lowercase and remove the leading or trailing slashes
var path = window.location.pathname.replace(/^\/|\/$/g, "").toLowerCase();
var newURL = vanityTable[path]; // look it up in our table
// if we found it in the table && newURL is different than where we are
if (newURL && (newURL != window.location.href)) {
window.location.replace(newURL); // go to the new URL
}
}
}
Old May-11-2012, 01:31 PM
#226
Ahtz is offline Ahtz
Beginner grinner
Nevermind, it apparently works now. haha. Sorry!!
Old May-18-2012, 06:43 AM
#227
ckeddie is offline ckeddie
Beginner grinner
One question about vanity URLs that I don't think has been covered in this thread yet...

I now have two custom banners on my account, with the secondary banner assigned to a specific category of albums. When I assign a vanity URL to a gallery within that category, it appears to load the primary banner first and then load the secondary banner. I've tested it out, and it looks like this only happens when I use the vanity URL. Is there something I can fix in my CSS or Javascript to correct this issue?

http://keddiebears.smugmug.com

The CKP category is the one with the secondary banner assigned to it. I've got a test gallery in that category right now:

http://keddiebears.smugmug.com/CKP/TEST/23000083_bVPbJL

And I've assigned this vanity URL to that gallery: http://keddiebears.smugmug.com/samplegallery

Thanks much!
Old May-18-2012, 07:21 AM
#228
jfriend is offline jfriend OP
Scripting dude-volunteer
Quote:
Originally Posted by ckeddie View Post
One question about vanity URLs that I don't think has been covered in this thread yet...

I now have two custom banners on my account, with the secondary banner assigned to a specific category of albums. When I assign a vanity URL to a gallery within that category, it appears to load the primary banner first and then load the secondary banner. I've tested it out, and it looks like this only happens when I use the vanity URL. Is there something I can fix in my CSS or Javascript to correct this issue?

http://keddiebears.smugmug.com

The CKP category is the one with the secondary banner assigned to it. I've got a test gallery in that category right now:

http://keddiebears.smugmug.com/CKP/TEST/23000083_bVPbJL
And I've assigned this vanity URL to that gallery: http://keddiebears.smugmug.com/samplegallery

Thanks much!
If you were using a custom header, not the Eazy Customizer header, then you could put the call to CheckRedirects() before your header and it would get executed before the homepage header displays. But, you appear to be using Easy Customizer so you can't use that option.

The other thing you can do is a little more involved.

Add this CSS:

Code:
/* hide custom header by default so it doesn't show before redirects */
#customHeaderContainer {display: none;}
Then, after the call to CheckRedirects() and in the same <script> block, add this:

Code:
/* show custom header now */
document.getElementById("customHeaderContainer").style.display = "block";
You should know that a consequence of doing this is that if someone views your site with javascript disabled, then your custom header will not show. This is probably OK because browsers with javascript disabled is fairly rare these days and Smugmug galleries pretty much don't work if javascript is disabled either.
__________________
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question

Last edited by jfriend; May-18-2012 at 07:34 AM.
Old May-18-2012, 08:07 AM
#229
ckeddie is offline ckeddie
Beginner grinner
Quote:
Originally Posted by jfriend View Post
If you were using a custom header, not the Eazy Customizer header, then you could put the call to CheckRedirects() before your header and it would get executed before the homepage header displays. But, you appear to be using Easy Customizer so you can't use that option.

The other thing you can do is a little more involved.

Add this CSS:

Code:
/* hide custom header by default so it doesn't show before redirects */
#customHeaderContainer {display: none;}
Then, after the call to CheckRedirects() and in the same <script> block, add this:

Code:
/* show custom header now */
document.getElementById("customHeaderContainer").style.display = "block";
You should know that a consequence of doing this is that if someone views your site with javascript disabled, then your custom header will not show. This is probably OK because browsers with javascript disabled is fairly rare these days and Smugmug galleries pretty much don't work if javascript is disabled either.
Thanks for the fast response! I tried adding the code from your second fix, and it doesn't appear to be working -- am I putting it in the wrong place?

I had originally used Easy Customizer a few years back to get the primary look of my site, and only just now am branching out into learning some CSS myself. So I'm probably going to end up going back and wiping the Easy Customizer settings and coding everything through the Advanced Customization, but if there's a faster intermediate solution (i.e., if you can help me figure out how I messed up your fix!), I'd appreciate the help!
Old May-18-2012, 08:29 AM
#230
jfriend is offline jfriend OP
Scripting dude-volunteer
Quote:
Originally Posted by ckeddie View Post
Thanks for the fast response! I tried adding the code from your second fix, and it doesn't appear to be working -- am I putting it in the wrong place?

I had originally used Easy Customizer a few years back to get the primary look of my site, and only just now am branching out into learning some CSS myself. So I'm probably going to end up going back and wiping the Easy Customizer settings and coding everything through the Advanced Customization, but if there's a faster intermediate solution (i.e., if you can help me figure out how I messed up your fix!), I'd appreciate the help!
Well, that's a bit of a surprise to me. In Chrome, Javascript keeps executing after the page redirect has been done. OK, we need a different approach.

Keep the CSS you have, but remove this code you added:

Code:
/* show custom header now that we know we are not redirecting to a new page */
document.getElementById("customHeaderContainer").style.display = "block";
Then, change your CheckRedirects() code to this:

Code:
function CheckRedirects() {
    if (YD.hasClass(document.body, 'homepage') || YD.hasClass(document.body, 'category')) {
        // get the path from the current URL, 
        // convert it to lowercase and remove the leading or trailing slashes
        var path = window.location.pathname.replace(/^\/|\/$/g, "").toLowerCase();
        var newURL = vanityTable[path]; // look it up in our table
        // if we found it in the table && newURL is different than where we are
        if (newURL && (newURL != window.location.href)) {
            window.location.replace(newURL); // go to the new URL
        } else {
            // show custom header now that we know we are not redirecting to a new page
            document.getElementById("customHeaderContainer").style.display = "block";
        }
    }
}
__________________
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
Old Jun-14-2012, 02:33 AM
#231
Mossbystrand is offline Mossbystrand
Beginner grinner
Cannot get the Vanity URLs to work
I tried to follow these instructions but the vanity URLs still don't work.

My website is www.spectoccasio.com

Here is the Top JavaScript

/*VANITY URL*/
var vanityTable =
{
"tours": "http://www.spectoccasio.com/gallery/13553927_QEgCC",
"about": "http://www.spectoccasio.com/gallery/13553921_HSXzn",
"contact": "http://www.spectoccasio.com/gallery/13553914_2EWkK",
"clients": "http://www.spectoccasio.com/gallery/23283319_H5gKxv",
"begravning": "http://www.spectoccasio.com/gallery/23281362_f6pJ6X"
};


// Vanity URLs code version 1.2
function CheckRedirects() {
if (YD.hasClass(document.body, 'homepage') || YD.hasClass(document.body, 'category')) {
// get the path from the current URL,
// convert it to lowercase and remove the leading or trailing slashes
var path = window.location.pathname.replace(/^\/|\/$/g, "").toLowerCase();
var newURL = vanityTable[path]; // look it up in our table
// if we found it in the table && newURL is different than where we are
if (newURL && (newURL != window.location.href)) {
window.location.replace(newURL); // go to the new URL
}
}


Thank you for your help!
Anneli
Old Jun-14-2012, 12:45 PM
#232
jfriend is offline jfriend OP
Scripting dude-volunteer
Quote:
Originally Posted by Mossbystrand View Post
I tried to follow these instructions but the vanity URLs still don't work.

My website is www.spectoccasio.com

Thank you for your help!
Anneli
You have a script error in your top javascript which prevents the other scripts from running. I'd suggest removing this from the top javascript:

Code:
function delHover() {
imgTags = document.getElementsByTagName("img");
for (i=0; i<imgTags.length; i++) {
imgTags[i].title = "";
imgTags[i].alt = "";
}
}
__________________
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
Old Jun-15-2012, 01:05 PM
#233
Mossbystrand is offline Mossbystrand
Beginner grinner
still problems with vanity URL
Thanks for the suggestion but it did not solve the problem. Any other suggestions?

Best,
Anneli

Quote:
Originally Posted by jfriend View Post
You have a script error in your top javascript which prevents the other scripts from running. I'd suggest removing this from the top javascript:

Code:
function delHover() {
imgTags = document.getElementsByTagName("img");
for (i=0; i<imgTags.length; i++) {
imgTags[i].title = "";
imgTags[i].alt = "";
}
}
Old Jun-15-2012, 01:20 PM
#234
jfriend is offline jfriend OP
Scripting dude-volunteer
Quote:
Originally Posted by Mossbystrand View Post
Thanks for the suggestion but it did not solve the problem. Any other suggestions?

Best,
Anneli
Next error is missing a closing brace at the end of this block (shown in red):

Code:
// Vanity URLs code version 1.2
function CheckRedirects() {
    if (YD.hasClass(document.body, 'homepage') || YD.hasClass(document.body, 'category')) {
        // get the path from the current URL, 
        // convert it to lowercase and remove the leading or trailing slashes
        var path = window.location.pathname.replace(/^\/|\/$/g, "").toLowerCase();
        var newURL = vanityTable[path]; // look it up in our table
        // if we found it in the table && newURL is different than where we are
        if (newURL && (newURL != window.location.href)) {
            window.location.replace(newURL); // go to the new URL
        }
    }
}
__________________
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
Old Jun-15-2012, 02:14 PM
#235
Mossbystrand is offline Mossbystrand
Beginner grinner
Thank you!

Quote:
Originally Posted by jfriend View Post
Next error is missing a closing brace at the end of this block (shown in red):

Code:
// Vanity URLs code version 1.2
function CheckRedirects() {
    if (YD.hasClass(document.body, 'homepage') || YD.hasClass(document.body, 'category')) {
        // get the path from the current URL, 
        // convert it to lowercase and remove the leading or trailing slashes
        var path = window.location.pathname.replace(/^\/|\/$/g, "").toLowerCase();
        var newURL = vanityTable[path]; // look it up in our table
        // if we found it in the table && newURL is different than where we are
        if (newURL && (newURL != window.location.href)) {
            window.location.replace(newURL); // go to the new URL
        }
    }
}
Old Jun-18-2012, 07:21 PM
#236
travischance is offline travischance
Major grins
travischance's Avatar
***Edit***Found the issue!!! Thanks John for putting this together. I've followed the steps & triple checked each line but cannot figure out why the vanity URL's aren't working....

TOP JAVASCRIPT
var vanityTable =
{
"washingtondc" : "http://travischancephotography.smugmug.com/Urban/Washington-DC/7531777_wMhr6q#!i=977186600&k=88qai",
"chicago" : "http://travischancephotography.smugmug.com/Urban/Chicago/17258114_pT5btg#!i=1310216061&k=G9qTsR7",
"newyork": "http://travischancephotography.smugmug.com/Urban/NYC/13394056_GNQcdw#!i=1175204442&k=WBjjq",
"lasvegas": "http://travischancephotography.smugmug.com/Urban/LasVegas/12282242_qTm5GB#!i=1302571472&k=BwKMM22"
}
// Vanity URLs code version 1.2
function CheckRedirects() {
if (YD.hasClass(document.body, 'homepage') || YD.hasClass(document.body, 'category')) {
// get the path from the current URL,
// convert it to lowercase and remove the leading or trailing slashes
var path = window.location.pathname.replace(/^\/|\/$/g, "").toLowerCase();
var newURL = vanityTable[path]; // look it up in our table
// if we found it in the table && newURL is different than where we are
if (newURL && (newURL != window.location.href)) {
window.location.replace(newURL); // go to the new URL
}
}
}
Step 5

CUSTOM HEADER
<script type="text/javascript" language="javascript">
CheckRedirects();
</script>
__________________
Travis M. Chance
Mark IV's | 7D
11-16 2.8 | 16-35 2.8L | 24-70 2.8L | 24-105 4L | 70-200 2.8L | 50 1.4 | 135 2L |300 2.8L | 580EX II's | PocketWizards
sitefacebook
Old Jul-17-2012, 07:43 PM
#237
Alexandra88 is offline Alexandra88
Big grins
Alexandra88's Avatar
Great!
This was very clear and beneficial.

My solution: Keep "info" or "about me" pages in a "links" gallery. No vanity URL is called Links.

THANKS

www.alexandramanning.com/info
Old May-10-2013, 05:36 PM
#238
camerondavidphotography is offline camerondavidphotography
Big grins
A question for clarity.

A vanity URL is really only useful for posting a link to a specific section of your smugmug to another site/email/etc. Correct?

I installed the code as described in this thread and got my one test gallery to work properly. However, once the vanity URL directs to the gallery, the actual URL (a jumbled mess of random letters/numbers) displays instead.

So I guess my actual question is... is there a way for the vanity URL to always display once redirected to appropriate page?
Old May-10-2013, 06:43 PM
#239
jfriend is offline jfriend OP
Scripting dude-volunteer
Quote:
Originally Posted by camerondavidphotography View Post
A question for clarity.

A vanity URL is really only useful for posting a link to a specific section of your smugmug to another site/email/etc. Correct?

I installed the code as described in this thread and got my one test gallery to work properly. However, once the vanity URL directs to the gallery, the actual URL (a jumbled mess of random letters/numbers) displays instead.

So I guess my actual question is... is there a way for the vanity URL to always display once redirected to appropriate page?
A vanity URL is only a temporary redirect URL that is shorter and you get to control the name for. There is no way to make the URL bar show the vanity URL after clicking on it. The actual destination (usually a gallery) will still have it's current gallery URL showing once the vanity URL does it's redirect. The feature you are asking for (pick your own custom URL for a gallery that shows in the URL bar) is not something Smugmug offers or something that can be done with customization with the current Smugmug design.
__________________
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
Old May-11-2013, 04:18 AM
#240
camerondavidphotography is offline camerondavidphotography
Big grins
Quote:
Originally Posted by jfriend View Post
A vanity URL is only a temporary redirect URL that is shorter and you get to control the name for. There is no way to make the URL bar show the vanity URL after clicking on it. The actual destination (usually a gallery) will still have it's current gallery URL showing once the vanity URL does it's redirect. The feature you are asking for (pick your own custom URL for a gallery that shows in the URL bar) is not something Smugmug offers or something that can be done with customization with the current Smugmug design.
That is what I figured. Just wanted to make sure. Thanks.
Page 12  of  12
« First 2 8 9 10 11 12
Tell The World!  

Thread Tools
Display Modes

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump