Skip to content

Commit

Permalink
Merge pull request #132 from stuartmaxwell:blog-sidebar
Browse files Browse the repository at this point in the history
Implement a blog sidebar
  • Loading branch information
stuartmaxwell authored Oct 21, 2024
2 parents 887ca0e + f1b9e89 commit 9881f5b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
13 changes: 13 additions & 0 deletions static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ h6 {
font-style: italic;
}

/* Use grid display for the main content with the sidebar class */
main.main-sidebar {
display: grid;
grid-template-columns: 1fr 0.25fr;
gap: 1em;
}

@media (max-width: 576px) {
.hide-at-xs {
display: none;
Expand All @@ -62,6 +69,12 @@ h6 {
.hide-at-s {
display: none;
}

main.main-sidebar {
display: grid;
grid-template-columns: 1fr;
gap: 1em;
}
}

.highlight pre {
Expand Down
2 changes: 1 addition & 1 deletion static/css/styles.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,24 @@
{% include "snippets/navbar.html" %}
</header>

<main class="container">
{% block content %}
{% endblock content %}
<main class="container main-sidebar">
<div>
{% block content %}
{% endblock content %}
</div>
<aside class="hide-at-s">
<nav>
<ul>
<li><strong>Recent Posts</strong></li>
</ul>
<ul>
{% get_recent_posts as posts %}
{% for post in posts %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</nav>
</aside>
</main>

</body>
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9881f5b

Please sign in to comment.