Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote all links in the "social" box with rel="me" attribute #285

Open
schtobia opened this issue Sep 30, 2021 · 8 comments
Open

Promote all links in the "social" box with rel="me" attribute #285

schtobia opened this issue Sep 30, 2021 · 8 comments
Labels
Milestone

Comments

@schtobia
Copy link
Contributor

This part here

Flex/templates/base.html

Lines 222 to 228 in a2b7d6d

{% for name, link in SOCIAL %}
<li>
<a {% if name == 'mastodon' %}rel="me"{% 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 %}

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?

@alexandrevicenzi
Copy link
Owner

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.

@schtobia
Copy link
Contributor Author

schtobia commented Oct 2, 2021

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>

@alexandrevicenzi
Copy link
Owner

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.

@schtobia
Copy link
Contributor Author

schtobia commented Oct 3, 2021

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.)

@alexandrevicenzi
Copy link
Owner

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.

@alexandrevicenzi alexandrevicenzi added this to the 3.0-dev milestone Mar 31, 2023
@alexandrevicenzi
Copy link
Owner

So, SOCIAL is a Pelican config, and if changed, will not be compatible with Pelican.

@schtobia
Copy link
Contributor Author

schtobia commented Apr 1, 2023

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.

@lioman
Copy link
Contributor

lioman commented Nov 3, 2023

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 %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants