Skip to content

Wrap blog templates with an ablog CSS selector #143

@choldgraf

Description

@choldgraf

Describe the feature

Currently, this extension has no way of knowing whether an inserted template is related to ABlog. For example:

from https://github.com/sunpy/ablog/blob/main/ablog/templates/authors.html :

{% if ablog.author %}
<h3><a href="{{ pathto(ablog.author.path) }}">{{ gettext('Authors') }}</a></h3>
<ul>
  {% for coll in ablog.author %} {% if coll %}
  <li>
    <a href="{{ pathto(coll.docname) }}">{{ coll }} ({{ coll|length }})</a>
  </li>
  {% endif %} {% endfor %}
</ul>
{% endif %}

This makes it harder to create CSS rules that make ABlog behave in certain ways (e.g. as a part of themes)

Proposed solution

An easy path forward would be to wrap all of those ablog templates with a CSS selector that was unique to the template. For example:

{% if ablog.author %}
<div class="ablog-sidebar-item ablog__authors">
<h3><a href="{{ pathto(ablog.author.path) }}">{{ gettext('Authors') }}</a></h3>
<ul>
  {% for coll in ablog.author %} {% if coll %}
  <li>
    <a href="{{ pathto(coll.docname) }}">{{ coll }} ({{ coll|length }})</a>
  </li>
  {% endif %} {% endfor %}
</ul>
</div>
{% endif %}

References

I think this is related to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions