简体   繁体   中英

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. Currently, it directs you to the path ending in '/beast/' and I'd like to replace it to '/blog'.

Here is the html code

<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">&nbsp;/&nbsp;</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:

<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:

<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. See link: https://support.squarespace.com/hc/en-us/articles/205814528 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM