logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
ray22901031  
#1 Posted : Wednesday, June 8, 2022 1:09:18 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
On line #12 of the "_MetaTags.cshtml" file we have the following razor code segment:

@if (!string.IsNullOrEmpty(objectUrl)) {
<link rel="canonical" href="@objectUrl" />
}

I also need to make sure that the value for objectUrl does not equal "default", but I'm not sure on the syntax.

Would appreciate any assistance.

Many Thanks

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

ray22901031  
#2 Posted : Wednesday, June 8, 2022 6:19:25 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
I think I have it.

@if (!string.IsNullOrEmpty(objectUrl) && (!objectUrl.Contains("Default"))) {
<link rel="canonical" href="@objectUrl" />
}

Anyone care to check - thanks
shaharyar  
#3 Posted : Thursday, June 9, 2022 3:18:33 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
These are two different requirements.

objectURL should not be equal to "default" = (!objectUrl.Equals("Default")
objectURL should not contain "default" = (!objectUrl.Contains("Default")

Also please make sure to take care of the letter cases when using hardcoded strings.

Hope this helps!

ray22901031  
#4 Posted : Thursday, June 9, 2022 8:01:06 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
How absolutely strange, you would figure that "(!objectUrl.Equals("Default")" would be the better choice, but it doesn't work. Please try it yourself and see what I mean.

I've also tried "(!objectUrl.Equals("/Default")", but that doesn't work either. So, I'll stay with the original, and I will make sure that there will never be a URL with the term "Default".

Strange indeed.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.