start to work in requests by cleaning up listing code
This commit is contained in:
@ -3,6 +3,7 @@ import { DateTime } from "luxon";
|
||||
export default function(eleventyConfig) {
|
||||
/* Filter by date */
|
||||
eleventyConfig.addFilter("filterByDate", (listings, date) => {
|
||||
if (date === null) return listings;
|
||||
date = DateTime.fromISO(date, { zone: "utc" });
|
||||
return listings.filter((listing) => {
|
||||
let postDate = DateTime.fromJSDate(listing.data.date, { zone: "utc" });
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
{% set tag = "offers" %}
|
||||
|
||||
<div id="listings">
|
||||
{% for tag in collections | getKeys | removeCoreTags | sortAlphabetically %}
|
||||
<div class="category">
|
||||
@ -5,10 +7,11 @@
|
||||
<h2>{{ tag }}</h2>
|
||||
<p>{{ tag | getTagline }}</p>
|
||||
</div>
|
||||
{% if collections[tag] | filterByDate(today) | length == 0 %}
|
||||
{% set listings = collections[tag] | filterByDate(day) | filterByTag(tag) %}
|
||||
{% if listings | length == 0 %}
|
||||
<p>No listings.</p>
|
||||
{% endif %}
|
||||
{% for listing in collections[tag] | filterByDate(today) | sortAlphabeticallyByTitle %}
|
||||
{% for listing in listings | sortAlphabeticallyByTitle %}
|
||||
{% include "listing.njk" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
@ -67,6 +67,10 @@ h1 {
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: .5rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
text-transform: capitalize;
|
||||
margin-bottom: .5rem;
|
||||
|
||||
@ -33,6 +33,12 @@ title: About the Classifieds
|
||||
you reach out to about compensation!
|
||||
</p>
|
||||
|
||||
<h2>How do I take down my listing?</h2>
|
||||
|
||||
<p>
|
||||
Message me and I'll remove it.
|
||||
</p>
|
||||
|
||||
<h2>Who made this?</h2>
|
||||
|
||||
<p>
|
||||
|
||||
@ -3,5 +3,5 @@ title: April 29th, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-04-29" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-04-29" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -3,5 +3,5 @@ title: May 1st, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-05-01" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-05-01" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -3,5 +3,5 @@ title: May 2nd, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-05-02" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-05-02" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -3,5 +3,5 @@ title: May 3rd, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-05-03" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-05-03" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -3,5 +3,5 @@ title: May 4th, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-05-04" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-05-04" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -3,5 +3,5 @@ title: May 5th, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-05-05" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-05-05" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -3,5 +3,5 @@ title: May 6th, 2026
|
||||
---
|
||||
{% css %}{% include "css/listings.css" %}{% endcss %}
|
||||
|
||||
{% set today = "2026-05-06" %}
|
||||
{% include "daily-listings.njk" %}
|
||||
{% set day = "2026-05-06" %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -14,20 +14,5 @@ title: FediLearns Classifieds
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="listings">
|
||||
{% for tag in collections | getKeys | removeCoreTags | sortAlphabetically %}
|
||||
<div class="category">
|
||||
<div class="category-title">
|
||||
<h2>{{ tag }}</h2>
|
||||
<p>{{ tag | getTagline }}</p>
|
||||
</div>
|
||||
{% set listings = collections[tag] | filterByTag("offers") %}
|
||||
{% if listings | length == 0 %}
|
||||
<p>No listings.</p>
|
||||
{% endif %}
|
||||
{% for listing in listings | sortAlphabeticallyByTitle %}
|
||||
{% include "listing.njk" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% set day = null %}
|
||||
{% include "listings.njk" %}
|
||||
|
||||
@ -9,12 +9,23 @@ title: Submit a Listing
|
||||
background-color: var(--color-gray);
|
||||
padding: .25rem;
|
||||
}
|
||||
|
||||
.requests-update {
|
||||
padding: 1rem;
|
||||
border: solid var(--color-cyan);
|
||||
}
|
||||
{% endcss %}
|
||||
|
||||
<p class="requests-update">
|
||||
<em>Hey! Listen!</em> I'm working on supporting requests as well as offers,
|
||||
so don't be surprised to see that on the submission form. Coming soon to the site!
|
||||
</p>
|
||||
|
||||
<p>To submit to the FediLearns Classifieds, you'll need:</p>
|
||||
|
||||
<ul>
|
||||
<li>the link to your fediverse profile</li>
|
||||
<li>whether your listing is an offer or a request for help</li>
|
||||
<li>the <a href="#category-guide">most relevant category</a> for your listing</li>
|
||||
<li>a title for your offering</li>
|
||||
<li>a short description</li>
|
||||
|
||||
Reference in New Issue
Block a user