Open schtobia opened 3 years ago
Not all links will be "me", one can add any links there, not sure about that. Some social networks would work. Might be better to just change name equals something to name in some range.
what about expanding the SOCIAL
variable in pelicanconf.py
to a triplet? That way we can conditionally assign each link its own relation:
<ul class="social">
{% for name, link, rel in SOCIAL %}
<li>
<a{% if name == 'mastodon' %} rel="me"{% elif rel %} rel="{{ rel }}"{% endif %} class="sc-{{ name }}" href="{{ link }}" target="_blank">
<i class="{% if name in ['envelope', 'rss'] %}fas{% else %}fab{% endif %} fa-{{ name }}"></i>
</a>
</li>
{% endfor %}
</ul>
It would work, but breaks compatibility with older settings, which could be a no go, unless there's an easy way to have an if old style do this else do that.
Yes, there is a way:
<ul class="social">
{% for tuple in SOCIAL %}
{% set name = tuple.0 %}
{% set link = tuple.1 %}
{% set rel = tuple.2 if tuple.2 else None %}
<li>
<a{% if name == 'mastodon' %} rel="me"{% elif rel %} rel="{{ rel }}"{% endif %} class="sc-{{ name }}" href="{{ link }}" target="_blank">
<i class="{% if name in ['envelope', 'rss'] %}fas{% else %}fab{% endif %} fa-{{ name }}"></i>
</a>
</li>
{% endfor %}
</ul>
(see my repo.)
Ok, perhaps it's time for 3.0 release, where we break some compatibility, and document properly how to migrate. Pelican itself has changed a lot since the origin of this theme.
I won't be against breaking changes, as long as we document everything properly, otherwise, people will open issues, which can be a problem.
So, SOCIAL is a Pelican config, and if changed, will not be compatible with Pelican.
That's why I 've suggested a non breaking solution. For everyone on Mastodon this is really important, as Mastodon uses this part to verify the identity.
I personally don't use pelican anymore (the PR is 18 months old), so for me it's not that important.
I think this can be closed as rel=me
is supported for mastodon and some other sites.
or it should be changed to something different like adding a setting to enable it in theme:
pelicanconf.py
SOCIAL = (
("a", "https://a.example/user"),
("b", "https://b.example/username"),
("c", "https://c.example/mysite"),
)
RELME= ["a", "b"]
sidebar.html
{% if SOCIAL %}
{% set solid = ['at', 'envelope', 'mailbox', 'rss'] %}
<ul class="social">
{% for name, link in SOCIAL %}
<li>
<a class="sc-{{ name }}"
{% if RELME %} {% if name in RELME %}rel="me"{% endif %} {% endif %}
href="{{ link }}"
target="_blank"
aria-label="{{ name }}">
<i class="{% if name in solid %}fa-solid{% else %}fa-brands{% endif %} fa-{{ name }}"></i>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
This part here
https://github.com/alexandrevicenzi/Flex/blob/a2b7d6de370779679875eb199279d3deea08f30f/templates/base.html#L222-L228
could be extended to promote the
rel="me"
attribute for all social links. This is according to the corresponding microformat and would be helpful for a Web Sign In.What do you think?