[英]How do I redirect an href link in Squarespace?
I am trying to redirect a link on a clickthrough title on an image in Squarespace. 我正在尝试在Squarespace中的图像上重定向点击标题上的链接。 Currently, it directs you to the path ending in '/beast/' and I'd like to replace it to '/blog'.
目前,它会将您引导至以'/ beast /'结尾的路径,并且我想将其替换为'/ blog'。
Here is the html code 这是html代码
<div class="collection-detail-wrapper" id="yui_3_17_2_4_1461830927597_1433">
<a href="/beast/" data-shrink-original-size="15" style="letter-spacing: 0.266667em;" id="yui_3_17_2_4_1461830927597_1432"><span class="folder-title">FORTE INDEX HOME</span><span class="folder-separator"> / </span><span class="collection-title">'LES SAUTEURS' WINS IN BERLIN</span></a>
</div>
And I've tried using either of these two codes both in the Header and Footer Code Injection sections 我已尝试在页眉和页脚代码注入部分中使用这两个代码中的任何一个
Javascript: 使用Javascript:
<script src="ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var a = document.querySelector('a[href="https://mauricio-gonzalezaranda-ec4f.squarespace.com/beast/"]');
if (a) {
a.setAttribute('href', 'https://mauricio-gonzalezaranda-ec4f.squarespace.com/blog')
}
</script>
JQuery: JQuery的:
<script src="ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$("#yui_3_17_2_4_1461830927597_1432").attr("href", "https://mauricio-gonzalezaranda-ec4f.squarespace.com/blog/");
</script>
or 要么
<script src="ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(".collection-detail-wrapper").attr("href", "https://mauricio-gonzalezaranda-ec4f.squarespace.com/blog/");
</script>
None of these have given me any results. 这些都没有给我任何结果。
This shouldn't require any coding at all. 这根本不需要任何编码。 Squarespace offers the ability to create a link inside of an Image Block and you can point it anywhere you want.
Squarespace提供了在Image Block内部创建链接的功能,您可以将其指向任何您想要的位置。 See link: https://support.squarespace.com/hc/en-us/articles/205814528 .
请参见链接: https : //support.squarespace.com/hc/en-us/articles/205814528 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.