Skip to content

Commit

Permalink
Merge pull request #716 from geoinquiets/better-invalid-links
Browse files Browse the repository at this point in the history
Showing invalid links better
  • Loading branch information
jsanz authored Jul 5, 2024
2 parents 548012f + ec0d3de commit 0535d7f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 24 deletions.
21 changes: 21 additions & 0 deletions _includes/link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<li {%if invalid == "true" %}class="invalid"{% endif %}>
{%if invalid == "true" %}
<img class="warning-invalid"
src="{{ site.baseurl }}/public/warning-64.png"
title="This link is tagged as invalid so it will probably won't work. A link to archive.org is added for your convenience, good luck!"
>
{% endif %}
{{desc}} {% if via != "" %}via {{via}}{% endif %}
{% if lang != "" %}[{{lang | upcase}}]{% endif %}
<br>
<span class="rafaga-li">
<a href="{{link}}">
{{link}}
</a>
{%if invalid == "true" %}
| <a class="archive-link" href="https://web.archive.org/web/*/{{link}}" >
archive.org
</a>
{% endif %}
</span>
</li>
6 changes: 0 additions & 6 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,5 @@ <h3 class="masthead-title">
</small>
</footer>
</div>
<script src="https://unpkg.com/quicklink"></script>
<script>
document.addEventListener('DOMContentLoaded', function(){
quicklink();
});
</script>
</body>
</html>
24 changes: 14 additions & 10 deletions _layouts/rafaga.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ <h1 class="post-title">
<div class="rafaga-links">
<ul>
{% for rafaga in page.rafagas %}

<li {%if rafaga.invalid %}style="text-decoration:line-through"{% endif %}>
{{rafaga.desc}} {% if rafaga.via %}via {{rafaga.via}}{% endif %}
{% if rafaga.lang %}[{{rafaga.lang | upcase}}]{% endif %}
<br>
{% unless rafaga.invalid %}<span class="rafaga-li"><a href="{{rafaga.link}}" {%if rafaga.nocheck %}data-proofer-ignore{% endif %}>{% endunless %}
{{rafaga.link}}
{% unless rafaga.invalid %}</a></span>{% endunless %}
</li>
{% endfor %}
{% capture desc %}{{rafaga.desc}}{% endcapture %}
{% capture link %}{{rafaga.link}}{% endcapture %}
{% capture via %}{{rafaga.via}}{% endcapture %}
{% capture desc %}{{rafaga.desc}}{% endcapture %}
{% capture invalid %}{{rafaga.invalid | default: false}}{% endcapture %}
{% capture lang %}{{rafaga.lang}}{% endcapture %}
{% include link.html
desc=desc
link=link
via=via
invalid=invalid
lang=lang
%}
{% endfor %}
</ul>
</div>

Expand Down
21 changes: 13 additions & 8 deletions _pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ <h1 class="post-title">
{% if post.rafagas %}
<ul>
{% for rafaga in post.rafagas %}
<li {%if rafaga.invalid %}style="text-decoration:line-through"{% endif %}>
{{rafaga.desc | truncate: 250}} {% if rafaga.via %}via {{rafaga.via}}{% endif %}
{% if rafaga.lang %}[{{rafaga.lang | upcase}}]{% endif %}
<br>
{% unless rafaga.invalid %}<span class="rafaga-li"><a href="{{rafaga.link}}" {%if rafaga.nocheck %}data-proofer-ignore{% endif %}>{% endunless %}
{{rafaga.link}}
{% unless rafaga.invalid %}</a></span>{% endunless %}
</li>
{% capture desc %}{{rafaga.desc}}{% endcapture %}
{% capture link %}{{rafaga.link}}{% endcapture %}
{% capture via %}{{rafaga.via}}{% endcapture %}
{% capture desc %}{{rafaga.desc}}{% endcapture %}
{% capture invalid %}{{rafaga.invalid | default: "false"}}{% endcapture %}
{% capture lang %}{{rafaga.lang}}{% endcapture %}
{% include link.html
desc=desc
link=link
via=via
invalid=invalid
lang=lang
%}
{% endfor %}
</ul>
{% endif %}
Expand Down
15 changes: 15 additions & 0 deletions _sass/_posts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@
.post ul a {
font-size:0.8em;
}

.post li.invalid {
font-style: italic;
}

.post img.warning-invalid {
display: inline;
height: 1em;
margin: 0;
padding: 0;
}

.post a.archive-link {
color: darkred;
}
Binary file added public/warning-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0535d7f

Please sign in to comment.