yous / whiteglass

Minimal, responsive Jekyll theme for hackers
https://yous.github.io/whiteglass/
MIT License
730 stars 198 forks source link

External URL isn't linked for posts #20

Closed jerryjrchen closed 6 years ago

jerryjrchen commented 6 years ago

Hi there, I noticed that the about page offered the following information about creating a post that links directly to a URL:

External URL

external-url turns the title of your post to a link. Specify a URL which you want to link to.

layout: post
title: Jekyll whiteglass theme
external-url: https://github.com/yous/whiteglass

But right now, it seems like all that happens is that the right arrow is added to the title. The anchor tag here still uses the post.url. Should it be using post.external-url if it's present, or am I misunderstanding this feature? https://github.com/yous/whiteglass/blob/818695c7855e7de977d3ff4e0d34fc5132e4deb7/_layouts/home.html#L19

jerryjrchen commented 6 years ago

Here's a quick fix I put together for the line in question:

{% if post.external-url %}
<a class="post-link" href="{{ post.external-url }}">{{ post.title | escape }} &rarr;</a>
{% else %}
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title | escape }}</a>
{% endif %}
yous commented 6 years ago

I intentionally used post.url on the home layout. But, on the post layout, the title links to post.external-url, so user can navigate to the both post.url and post.external-url. This theme hasn't a UI providing permalink of the post, so I just keep using post.url on home.

Maybe we can add permalink for each post that has an external URL. SVG icons? How do you think?

jerryjrchen commented 6 years ago

I think having some sort of link on the home page as well would be good.

For example, Daring Fireball gets around the problem by having the title link to an external URL and providing a separate icon (a star) that links to the page of the post. This is kind of the opposite of having an SVG icon for the URL, but maybe that would be more intuitive.

yous commented 6 years ago

Yes, if we add permalink icon, the post title should link to the external URL. But I haven't thought about what will be good for the icon. Also we can use just text link for permalinks, along with date and categories, I think?

jerryjrchen commented 6 years ago

Could you clarify what you mean by "use just text link for permalinks"?

yous commented 6 years ago

I meant using [link](...) instead of SVG icons like Daring Fireball.

jerryjrchen commented 6 years ago

Yeah, that sounds reasonable to me.

yous commented 6 years ago

Hi @jerryjrchen, I've just released the version 1.6.0 for this. Now every post with external URL will be linked to that external URL directly. Also there will be additional link "Permalink" for such posts.