Skip to content

Commit

Permalink
Create sidebar version info section
Browse files Browse the repository at this point in the history
Contains the version string and the date updated.
  • Loading branch information
jonathansick committed Nov 22, 2022
1 parent dff14bc commit 3a633ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/technote/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ def date_updated_iso(self) -> Optional[str]:
else:
return None

@property
def version(self) -> Optional[str]:
"""The version, as a string if available."""
return self.toml.technote.version

def set_content_title(self, title: str) -> None:
"""Set the title from the content nodes."""
self._content_title = title
Expand Down
12 changes: 11 additions & 1 deletion src/technote/theme/components/sidebar-version.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<section class="technote-sidebar-section">
<h2 class="technote-sidebar-section__heading">Version</h2>

{% block version %}
{% if technote.version %}
<p class="technote-sidebar-version__version"><span class="technote-sidebar-version__label">Version</span> <span class="technote-sidebar-version__value">{{technote.version}}</span></p>
{% endif %}
{% endblock version %}

{% block date_updated %}
{% if technote.date_updated_iso %}
<time datetime="technote.date_updated_iso">{{ technote.date_updated_iso }}</time>
<p class="technote-sidebar-version__date"><span class="technote-sidebar-version__label">Updated</span> <time class="technote-sidebar-version__value" datetime="technote.date_updated_iso">{{ technote.date_updated_iso }}</time></p>
{% endif %}
{% endblock date_updated %}
</section>

0 comments on commit 3a633ff

Please sign in to comment.