Quantcast
Channel: Squarespace Answers - latest questions
Viewing all articles
Browse latest Browse all 21023

How do I change "Read more" link to {sourceURL} if post is from certain category?

$
0
0

So I'm using the template Avenue with developer mode turned on. My blog has a certain category of posts that all contain external links. This category is called "Guest posts", and for each of these posts I want the "Read more" link that follows the excerpt to link to {sourceURL} (the external link) rather than {fullURL} (the url of the post on my blog).

Here's the relevant snippet of code from the blog.list file:

<!--POST BODY-->

  {.excerpt?}
    <div class="body entry-content">{excerpt} <a class="read-more" href="{fullUrl}">Read more</a></div>
  {.or}
    {.section body}<div class="body entry-content">{@}</div>{.end}
    {.passthrough?}{.or}{.section sourceUrl}<div class="entry-source">Source: <a href="{sourceUrl}" target="_blank">{sourceUrl|truncate 42}</a></div>{.end}{.end}  
  {.end}

Somehow I need to change this bit:

<a class="read-more" href="{fullUrl}">Read more</a></div>

to:

<a class="read-more" href="{sourceUrl}">Read more</a></div>

only if the post is categorised under "Guest posts". The "Read more" link on the rest of my posts still needs to link to {fullUrl}.

For reference, here's a link to my blog: http://sivioco.com/blog

If anybody could help with this it would be much appreciated! Thanks.


Viewing all articles
Browse latest Browse all 21023

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>