Skip to content

Commit

Permalink
simple photo-note handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lchski committed Dec 6, 2022
1 parent 2924f11 commit 302a6cd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
9 changes: 9 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ collections:
notes:
output: true
permalink: /notes/:title/
photos:
output: true
permalink: /photos/:title/

defaults:
-
Expand All @@ -53,6 +56,12 @@ defaults:
type: "notes" # a collection in your site, in plural form
values:
layout: "study--note"
-
scope:
path: ""
type: "photos" # a collection in your site, in plural form
values:
layout: "study--photo"

# Build settings
markdown: kramdown
Expand Down
35 changes: 35 additions & 0 deletions _layouts/study--photo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: study
site_section: study
include_sidebar: true
sidebar_type: note
---

<article>
{% if page.photo %}
{% for photo in page.photo %}
<img src="{{ photo.url }}" alt="{{ photo.alt }}">
{% endfor %}
{% endif %}

<div class="f3 measure lh-copy serif nested-list-item-spacing">
{{ content }}
</div>

<p class="meta">
{{ page.date | date: "%B %e, %Y at %l:%S %P" }}
{% if page.source %}
({{ page.source | append: "\)" | markdownify | remove: "<p>" | remove: "</p>" }}
{% endif %}
</p>

{% if page.syndication %}
<p class="meta">Also at:</p>
<ul class="meta mt0">
{% for syndicated_copy in page.syndication %}
<li><a href="{{ syndicated_copy }}">{{ syndicated_copy }}</a></li>
{% endfor %}
</ul>
{% endif %}

</article>
1 change: 1 addition & 0 deletions _photos/2022-11-24-tho5h.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
date: 2022-11-24T16:28:02.811-05:00
photo:
- url: /media/photos/2022/11/24/x59ko.jpg
alt: A grey sidewalk turned white with salt.
syndication:
- https://mastodon.social/@lchski/109400906574479607
---
Expand Down
7 changes: 6 additions & 1 deletion notes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ <h1 class="page__intro">Notes</h1>
</header>

<ul class="block-list text-item-list spacey-list">
{% assign sorted_notes = site.notes | sort: 'date' | reverse %}
{% assign sorted_notes = site.notes | concat: site.photos | sort: 'date' | reverse %}
{% for note in sorted_notes %}
<li>
{% if note.photo %}
{% for photo in note.photo %}
<img src="{{ photo.url }}" alt="{{ photo.alt }}">
{% endfor %}
{% endif %}
{{ note.content | markdownify }}
<p class="meta">
<a href="{{ note.url }}">{{ note.date | date: "%B %e, %Y at %l:%S %P" }}</a>
Expand Down

0 comments on commit 302a6cd

Please sign in to comment.