If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / Best way to write an href link, in a product description.

Best way to write an href link, in a product description.

Started by mcpisik on 26 Oct 2018, 6:27 PM · Views: 412

Results 1 to 6 of 6
26 Oct 2018, 6:27 PM
#1
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Best way to write an href link, in a product description.

Hi,
In a product description, we have links such as:
<a href="http://oursite.com/hire-ladies-costumes/dazzling-silver-disco"> (Used in an image link)

Now that we are using SSL, I'm fixing those products to not give the 'Not secure' message in browsers.

My question is:
Is changing it to <a href="/hire-ladies-costumes/dazzling-silver-disco">
a good fix? It works.

OR for ranking etc. should it include our domain name: https://oursite.com/hire-ladies-costumes/dazzling-silver-disco">

Both work, but I don't know if one provides better link optimisation or is considered an internal link etc?

I have about 4000 to change, so this is quite important to get right :)

Thanks!

26 Oct 2018, 8:24 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Best way to write an href link, in a product description.

Personally, I would use the link as relative to the current base href on the page which already ends in a slash and therefore would use <a href="hire-ladies-costumes/dazzling-silver-disco"> where the first slash is not included. In this way, no matter where in your file structure the site is placed (and no matter what domain it is hosted on) the content is relative to the current store.

This is how it would seem other such areas of your site are found by search engines considering that is how other aspects built in the site are referenced.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

26 Oct 2018, 11:58 PM
#3
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Best way to write an href link, in a product description.

Always helpful thanks mc123

27 Oct 2018, 5:46 AM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Best way to write an href link, in a product description.

mc12345678:

Personally, I would use the link as relative to the current base href on the page which already ends in a slash and therefore would use <a href="hire-ladies-costumes/dazzling-silver-disco"> where the first slash is not included. In this way, no matter where in your file structure the site is placed (and no matter what domain it is hosted on) the content is relative to the current store.

+1! In other words, if you migrate your store from the top level to a subfolder (i.e. from oursite.com to oursite.com/store), it still works. This will save you HOURS of grief. How do I know this? Oh ... no reason ... :blush:

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

27 Oct 2018, 7:24 AM
#5
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Best way to write an href link, in a product description.

Ah yes, thanks!

28 Oct 2018, 9:49 AM
#6
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: Best way to write an href link, in a product description.

I see you are using friendly urls....that may change. I would never use that in a hard-coded link.

In my opinion one should only use the raw url for things you are embedding in the site, and they should be relative:

<a href="index.php?main_page=product_info&cpath=1_2274_2276_2278&products_id=4755">

this will never change.

Actually I encode the ampersands too
<a href="index.php?main_page=product_info&cpath=1_2274_2276_2278&products_id=4755">

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...