shopifyÔÚбêÇ©Öз¿ªÍⲿÁ´½ÓÒÔ¼°Ìí¼Ó´úÂë°ì·¨
ÔÚбêÇ©Öз¿ªÍⲿÁ´½Ó
±¸×¢
ÈôÊÇÄúʹÓà Shopify µÄÃâ·ÑÄ£°å£¬£¬£¬£¬£¬£¬Äú¿ÉÒÔÁªÏµ Shopify Ö§³ÖÍŶӻñµÃ¹ØÓڴ˽̵̳Ä×ÊÖú¡£¡£¡£¡£¡£¡£´Ë½Ì³ÌÐèÒª 15 ·ÖÖÓµÄÉè¼ÆÊ±¼ä¡£¡£¡£¡£¡£¡£ÈôÒªÏàʶÏêÇ飬£¬£¬£¬£¬£¬Çë²ÎÔÄ Support for themes¡£¡£¡£¡£¡£¡£
±¸×¢
´Ë×Ô½ç˵ÓÃÓÚ¸´¹Å Shopify Ä£°å£¬£¬£¬£¬£¬£¬²»ÊÊÓÃÓÚ¡°Online Store 2.0¡±Ä£°å¡£¡£¡£¡£¡£¡£
ÕÒµ½ÄúµÄÄ£°å¼Ü¹¹°æ±¾
̽Ë÷¡°Online Store 2.0¡±Ä£°å×Ô½ç˵
Äú¿ÉÒÔÏòÄ£°åÖÐÌí¼ÓһЩ´úÂ룬£¬£¬£¬£¬£¬ÓÃÓÚʹÄúÔÚÏßÊÐËÁÖеÄÍⲿÁ´½ÓÔÚеÄä¯ÀÀÆ÷±êÇ©Öз¿ª¡£¡£¡£¡£¡£¡£ÕâÑù×ö¿ÉÄܺÜÓÐ×ÊÖú£¬£¬£¬£¬£¬£¬ÓÉÓÚÕâÓÐÖúÓÚ±ÜÃâ¿Í»§ÍÑÀëÄúµÄÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£¡£ÍⲿÁ´½ÓÊǽ«¿Í»§¶¨Ïòµ½ÆäËûÍøÕ¾µÄ URL£¬£¬£¬£¬£¬£¬ÀýÈçÉ罻ýÌåͼ±êÖаüÀ¨µÄÁ´½Ó¡£¡£¡£¡£¡£¡£
½«Ò»Ð©´úÂëÌí¼Óµ½ÄúÄ£°åµÄ JavaScript ÎļþÖÐ
ÈôÒªÔÚеÄä¯ÀÀÆ÷±êÇ©Öз¿ªÍⲿÁ´½Ó£¬£¬£¬£¬£¬£¬ÄúÐèÒª±à¼Ä£°åµÄ JavaScript Îļþ¡£¡£¡£¡£¡£¡£
PC£º
ÔÚ Shopify ºǫ́ÖУ¬£¬£¬£¬£¬£¬×ªµ½ÔÚÏßÊÐËÁ > Ä£°å¡£¡£¡£¡£¡£¡£
ÕÒµ½Òª±à¼µÄÄ£°å£¬£¬£¬£¬£¬£¬È»ºóµã»÷²Ù×÷ > ±à¼´úÂë¡£¡£¡£¡£¡£¡£
ÔÚ Assets Ŀ¼ÖУ¬£¬£¬£¬£¬£¬µã»÷ÒÔÏÂÒ»Ï
- theme.js - theme.js.liquid - custom.js
½«ÒÔÏ´úÂëÕ³Ìùµ½Îļþµ×²¿£º
var links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£
Æ»¹ûϵͳ£º
ÔÚ Shopify Ó¦ÓÃÖУ¬£¬£¬£¬£¬£¬Çá´¥ÊÐËÁ¡£¡£¡£¡£¡£¡£
ÔÚÏúÊÛÇþµÀ²¿·ÖÖУ¬£¬£¬£¬£¬£¬Çá´¥ÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£¡£
Çá´¥ Manage themes£¨ÖÎÀíÄ£°å£©¡£¡£¡£¡£¡£¡£
ÕÒµ½Òª±à¼µÄÄ£°å£¬£¬£¬£¬£¬£¬È»ºóµã»÷²Ù×÷ > ±à¼´úÂë¡£¡£¡£¡£¡£¡£
ÔÚ Assets Ŀ¼ÖУ¬£¬£¬£¬£¬£¬µã»÷ÒÔÏÂÒ»Ï
- theme.js - theme.js.liquid - custom.js
½«ÒÔÏ´úÂëÕ³Ìùµ½Îļþµ×²¿£º
var links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£
°²×¿ÏµÍ³£º
ÔÚ Shopify Ó¦ÓÃÖУ¬£¬£¬£¬£¬£¬Çá´¥ÊÐËÁ¡£¡£¡£¡£¡£¡£
ÔÚÏúÊÛÇþµÀ²¿·ÖÖУ¬£¬£¬£¬£¬£¬Çá´¥ÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£¡£
Çá´¥ Manage themes£¨ÖÎÀíÄ£°å£©¡£¡£¡£¡£¡£¡£
ÕÒµ½Òª±à¼µÄÄ£°å£¬£¬£¬£¬£¬£¬È»ºóµã»÷²Ù×÷ > ±à¼´úÂë¡£¡£¡£¡£¡£¡£
ÔÚ Assets Ŀ¼ÖУ¬£¬£¬£¬£¬£¬µã»÷ÒÔÏÂÒ»Ï
- theme.js - theme.js.liquid - custom.js
½«ÒÔÏ´úÂëÕ³Ìùµ½Îļþµ×²¿£º
var links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£
ShopifyÉÌ»§¹ÙÍøÔÎÄÏêÇ飺
Open external links in a new tab
Note
If you use a free theme from Shopify, then you might be able to contact Shopify Support for help with this tutorial. It requires 15 minutes of design time. To learn more, refer to Support for themes.
Note
This customization is for vintage Shopify themes, and doesn't apply to Online Store 2.0 themes.
Find out your theme's architecture version
Explore Online Store 2.0 theme customizations
You can add some code to your theme that causes external links on your online store to open in a new browser tab. This can be beneficial because it helps to prevent customers from navigating away from your online store. External links are URLs that direct customers to different websites, such as the links included in social media icons.
Add some code to your theme's JavaScript file
To have external links open in a new browser tab, you need to edit your theme's JavaScript file.
PC£º
From your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Assets directory, click one of the following:
theme.js
theme.js.liquid
custom.jsPaste the following code at the bottom of the file:
var links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }Click Save.
iPhone£º
From the Shopify app, tap Store.
In the Sales channels section, tap Online Store.
Tap Manage themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Assets directory, click one of the following:
theme.js
theme.js.liquid
custom.jsPaste the following code at the bottom of the file:
var links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }Click Save.
Android£º
From the Shopify app, tap Store.
In the Sales channels section, tap Online Store.
Tap Manage themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Assets directory, click one of the following:
theme.js
theme.js.liquid
custom.jsPaste the following code at the bottom of the file:
var links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }Click Save.
ÎÄÕÂÄÚÈÝȪԴ£ºShopifyÉÌ»§¹Ù·½ÍøÕ¾
- 1shopeeƽ̨ΪʲôҪÉèÖÃÔ¤¹ºÇåµ¥ÏÞÖÆ£¿£¿£¿£¿£¿£¿£¿
- 2¿ç¾³µçÉÌÔõÑù°Ñ¿Ø±¾Ç®
- 3ÑÇÂíÑ·Âô¼Ò±¸Õ½ºÚÎåÍøÒ»´ó´ÙµÄÁù¸ö¼¼ÇÉ
- 4µêÐ¡ÃØÔõô¹ØÁªÉϼÜËÙÂôͨ²úÆ·£¿£¿£¿£¿£¿£¿£¿
- 5shopify×°ÖÃGoogleÍøÕ¾Õ¾³¤
- 6ÔÚÑÇÂíÑ·ÉÏÂôÒ·þµÄ×¢ÖØÊÂÏî
- 7ÔõÑù×èÖ¹TiktokСµêÔâÓö¶þÉóºÍ·â½û
- 8×ÔÁ¦Õ¾ÏúÊÛÓÅ»¯Õï¶Ï¼°½â¾ö¼Æ»®
- 9ÍâóԱдÓʼþÊ±Òª×¢ÖØ½Ú×àºÍÓïÆø
- 10souqÂô¼Òͨ¹ýfbs·¢»õµÄÓÅÊÆºÍÊÕ·ÑÏÈÈÝ