Reputation: 43
I'm trying to make my tumblr posts link directly to the source when clicked rather than going to the post page and having the source link there to click.
Here's the code I have for the photo posts.
{block:Photo}
<div class="permalink"><a href="{Permalink}">{MonthNumber}.{DayOfMonthWithZero}.{ShortYear}</a></div>
<div class="photo">
<div class="photobox"><a href="{Permalink}"><img src="{PhotoURL-250}" alt="{PhotoAlt}"/></a></div>
{block:Caption}
<div class="caption">{Caption}</div>
{/block:Caption}
</div>
{/block:Photo}
I've tried changing the photobox 'permalink' to source etc with no avail.
Anyone got any ideas?
Upvotes: 1
Views: 12781
Reputation: 31718
In the hope that someone who needs this will find it, here's a way I found to show {LinkURL}
when it's available, and some other url when it's not.
Tumblr offers {block:LinkURL}
to display some code when {LinkURL}
is available, but there's no {block:NoLinkURL}
to use when {LinkURL}
is NOT available.
Ideally, this should be possible:
<a
{block:LinkURL}href="{LinkURL}"{/block:LinkURL}
{block:NoLinkURL}href="{Permalink}"{/block:NoLinkURL}> <!-- does NOT work -->
<img src="{PhotoURL-400}"/>
</a>
But {block:NoLinkURL}
doesn't exist, so I'm using {block:LinkURL}
to hijack the normal link instead:
<a {block:LinkURL} href="{LinkURL}" data-ignored-{/block:LinkURL}href="{Permalink}">
<img src="{PhotoURL-400}"/>
</a>
If {LinkURL}
is available both links will be in the HTML, but only one is read.
This is the output when {LinkURL}
is not available:
<a href="/permalink">
<img src="/image.jpg"/>
</a>
And this when is the output when {LinkURL}
is available:
<a href="/linkurl" data-ignored-href="/permalink">
<img src="/image.jpg"/>
</a>
Upvotes: 1
Reputation:
after comments edit
It should be <a href="{LinkURL}">
You have to make sure when you're adding the image that you've specified the target as outside of tumblr too.
Upvotes: 0