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
|
|
|
|
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
|
|
|
|
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!
|
|
|
|
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.
|
|
|
|
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.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close