Skip to content

Commit

Permalink
Adds code for Atom feed
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrythall committed May 5, 2024
1 parent 3a6311d commit 7bafbb0
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 87 deletions.
64 changes: 5 additions & 59 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,12 @@ const path = require('path');
const Image = require('@11ty/eleventy-img');
const markdownIt = require("markdown-it");

module.exports = (config) => {
/*
Setup collections
https://www.11ty.dev/docs/collections/
*/
config.addCollection("posts", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/posts/*.md");
});

config.addCollection("places", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/places/*.md");
});

config.addCollection("presenters", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/presenters/*.md");
});
const setupCollections = require('./lib/collections');
const setupFeed = require('./lib/feed');

config.addCollection("organizers", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/organizers/*.md").sort(function(a, b) {
let nameA = a.data.name.toUpperCase();
let nameB = b.data.name.toUpperCase();
if (nameA < nameB) return -1;
else if (nameA > nameB) return 1;
else return 0;
}).filter(item => !item.data.hidden);
});

config.addCollection("sponsorsByLevel", function(collectionApi) {
const sponsors = collectionApi.getFilteredByGlob("src/_content/sponsors/*.md");
const visibleSponsors = sponsors.filter(sponsor => !sponsor.data.hidden);
const levelOrder = [
"Diamond",
"Platinum",
"Gold",
"Silver",
"Bronze",
"Coffee",
"Opportunity Grant",
"Community",
];

const sponsorsByLevel = visibleSponsors.reduce((acc, sponsor) => {
const level = sponsor.data.level;
if (!acc[level]) {
acc[level] = [];
}
acc[level].push(sponsor);
return acc;
}, {});

// Sort levels based on predefined order
const sortedSponsorsByLevel = {};
levelOrder.forEach(level => {
if (sponsorsByLevel[level]) {
sortedSponsorsByLevel[level] = sponsorsByLevel[level];
}
});

return sortedSponsorsByLevel;
});
module.exports = (config) => {
setupCollections(config);
setupFeed(config);

/*
Setup passthrough file copy
Expand Down
61 changes: 61 additions & 0 deletions lib/collections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module.exports = function(config) {
/*
Setup collections
https://www.11ty.dev/docs/collections/
*/
config.addCollection("posts", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/posts/*.md");
});

config.addCollection("places", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/places/*.md");
});

config.addCollection("presenters", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/presenters/*.md");
});

config.addCollection("organizers", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/_content/organizers/*.md").sort(function(a, b) {
let nameA = a.data.name.toUpperCase();
let nameB = b.data.name.toUpperCase();
if (nameA < nameB) return -1;
else if (nameA > nameB) return 1;
else return 0;
}).filter(item => !item.data.hidden);
});

config.addCollection("sponsorsByLevel", function(collectionApi) {
const sponsors = collectionApi.getFilteredByGlob("src/_content/sponsors/*.md");
const visibleSponsors = sponsors.filter(sponsor => !sponsor.data.hidden);
const levelOrder = [
"Diamond",
"Platinum",
"Gold",
"Silver",
"Bronze",
"Coffee",
"Opportunity Grant",
"Community",
];

const sponsorsByLevel = visibleSponsors.reduce((acc, sponsor) => {
const level = sponsor.data.level;
if (!acc[level]) {
acc[level] = [];
}
acc[level].push(sponsor);
return acc;
}, {});

// Sort levels based on predefined order
const sortedSponsorsByLevel = {};
levelOrder.forEach(level => {
if (sponsorsByLevel[level]) {
sortedSponsorsByLevel[level] = sponsorsByLevel[level];
}
});

return sortedSponsorsByLevel;
});
}
21 changes: 21 additions & 0 deletions lib/feed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const pluginRss = require("@11ty/eleventy-plugin-rss");

module.exports = function(config) {
config.addPlugin(pluginRss);

// eleventy-plugin-rss is Nunjucks-only, so add filters for Liquid
config.addLiquidFilter(
"dateToRfc3339",
pluginRss.dateToRfc3339
);

config.addLiquidFilter(
"getNewestCollectionItemDate",
pluginRss.getNewestCollectionItemDate
);

config.addLiquidFilter(
"htmlToAbsoluteUrls",
pluginRss.htmlToAbsoluteUrls
);
}
46 changes: 22 additions & 24 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
],
"author": "DEFNA",
"bugs": {
"url": "https://github.com/djangocon/durham.djangocon.us/issues"
"url": "https://github.com/djangocon/2024.djangocon.us/issues"
},
"homepage": "https://github.com/djangocon/durham.djangocon.us#README",
"homepage": "https://github.com/djangocon/2024.djangocon.us#README",
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-img": "^4.0.2",
"@tailwindcss/container-queries": "^0.1.1",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@tailwindcss/typography": "^0.5.10",
"autoprefixer": "^10.4.18",
"concurrently": "^8.2.2",
Expand Down
4 changes: 2 additions & 2 deletions src/about/conduct.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h1 class="mb-8 pageheading">{{ title }}</h1>
<section class="self-start p-8 prose bg-white border-4 rounded border-central-park-green lg:prose-lg">
<h3 class="mb-8 text-lg font-bold font-heading lg:text-2xl">Need help?</h3>
<div class="space-y-6 lead">
<p>If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact the conference Code of Conduct committee at <a href="mailto:{{site.conduct_email}}" class="link">{{site.conduct_email}}</a>{% comment %} or <a href="tel:201-899-4189" class="link">201-899-4189</a>{% endcomment %}.</p>
<p>If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact the conference Code of Conduct committee at <a href="mailto:{{ site.conduct_email }}" class="link">{{ site.conduct_email }}</a>{% comment %} or <a href="tel:201-899-4189" class="link">201-899-4189</a>{% endcomment %}.</p>
<p>To ensure we receive all the necessary information, please refer to our <a href="#procedures-for-reporting-incidents" class="link">Procedures for Reporting Incidents</a>.</p>
</div>
</section>
Expand Down Expand Up @@ -186,7 +186,7 @@ <h2>Examples of Inappropriate Behavior</h2>

<h2>Photography</h2>

<p>In order to make DjangoCon US 2024 a great experience for everyone, do not photograph, video, or audio record anyone at DjangoCon without their express permission, sought in advance. If someone does not want to be photographed, video or audio recorded, please respect their wishes.</p>
<p>In order to make DjangoCon US {{ site.conf_year }} a great experience for everyone, do not photograph, video, or audio record anyone at DjangoCon without their express permission, sought in advance. If someone does not want to be photographed, video or audio recorded, please respect their wishes.</p>

<p>Crowd shots are permitted, but when only the faces of a few people are visible, permission should be sought from all of those individuals.</p>

Expand Down
Loading

0 comments on commit 7bafbb0

Please sign in to comment.