Skip to content

Conversation

@arkhi
Copy link
Member

@arkhi arkhi commented Nov 11, 2025

@alifeee made a proposal in a previous PR.

This is a different approach using structured data instead of HTML:

  1. Each participant has their own space to add data: the Toml file.
  2. The data is massaged to fit our use.

This PR does not touch master for now.


Things in this PR:

  • Add .editorconfig.
  • Add linters for JS and Toml files.
  • Use Eleventy.
  • Add basic nunjucks templates, based on existing files.
  • Structure data in toml files.
  • Fix data consistency.
  • Tag or remove obvious spam (Still quite a few to check in my opinion).
  • Create Github Actions to deploy on staging for now.
  • Remove github pages-related files.
  • Update link to create an entry.
  • Update README.md.

Some URL might lead to spam right now, but might have been totally legit websites at the time of submission. This is why some websites were not always removed.

Part of #160, closes #166.

From HTML to Toml files.

I used the following template and globalData to generate Toml files:

---
pagination:
  data: tomlFromLegacyHTML
  size: 1
  alias: participant
permalink: _exports/{{ participant | replace("/", "") | escape }}.toml
eleventyAllowMissingExtension: true
---
display = "{{ tomlFromLegacyHTML[participant].display | safe }}"

# Websites
# ------------------------------------------------------------------------------
{% for website in tomlFromLegacyHTML[participant].websites %}
[[websites]]
url   = "{{ website.url }}"
title = "{{ website.title }}"
years = [{{ website.years }}]
{% endfor %}
  // Create Toml files based on legacy HTML files.
  // TODO: Tweaked files to restore mistakes.
  eleventyConfig.addGlobalData("tomlFromLegacyHTML", () => {
    // Comment next line to create toml files based on existing HTML files.
    // Files can be found in _site/exports/participants/.
    return {};

    const files = fs.readdirSync(`./_assets/legacy-html-files/`);
    const participants = {};
    const findWebsite = (websites, url) => websites.find(website => website.url === url);

    for (const file of files) {
      const content = fs.readFileSync(
        `./_assets/legacy-html-files/${file}`, 'utf8'
      );

      const listContent = /            <li>(?<inner>.*)<\/li>/g;
      const listItems = [...content.matchAll(listContent)];

      listItems.forEach((item, index) => {
        // SEE https://regex101.com/r/g4rGk7
        // TODO Improve grouping?
        const groups = [...item.groups.inner.matchAll(/(?<prefix>.*?)[\W+]*((<a.+?href="(?<url>[^"]+)">(?<title>.+?)<\/a>)[\W+]*?)/g)];

        // Set default values for slug.
        let participantID = groups[0]?.groups?.prefix?.trim();
        let title = groups[0]?.groups?.title?.trim();

        groups.forEach(group => {
          const url = group.groups.url;
          const currentYear = file.replace('.html', '');

          // Slugify potential id, with fallback in case of non-latin characters.
          const slug =
            `${eleventyConfig.getFilter("slugify")(participantID || title)}`
            || `${title}-${index}`;

          title = group.groups.title;

          // Create entry if not already present.
          if (!participants[slug]) {
            participants[slug] = {
              display: participantID || title,
              websites: [],
            };
          }

          // Add website to existing entries.
          if (!findWebsite(participants[slug].websites, url)) {
            participants[slug].websites.push({
              url: url,
              title: title || participantID,
              years: [currentYear],
            });
          } else {
            if (!findWebsite(participants[slug].websites, url).years.find(year => year === currentYear)) {
              findWebsite(participants[slug].websites, url).years.push(
                currentYear
              );
            }
          }
        });
      });
    }

    return participants;
  });

alifeee and others added 30 commits May 10, 2024 00:02
* Allow the use of Toml formats.
* Add _Global Data Files_ as examples.
* Use nunjucks for templates.
* Move legacy files into separate folder.
* Tweak eleventy.config.js.
* Based on _Global Data Files_ participants, use `eleventyComputed` to provide another structure to templates.
* Based on _Global Data Files_ participants, use `before` in pagination to provide pagination by years.
@arkhi arkhi marked this pull request as ready for review November 11, 2025 21:18
@arkhi arkhi requested a review from j9t November 11, 2025 21:19
@arkhi arkhi force-pushed the issues/160-refactor-eleventy branch from fe0aa2b to 7326b91 Compare November 11, 2025 23:32
It can not parse nunjucks template within the permalink.
@j9t
Copy link
Member

j9t commented Nov 12, 2025

I’m on the road for a few days—will try to review in between but can’t tell yet.

arkhi and others added 8 commits November 13, 2025 23:07
* Use array-like data to define what to get from the global data. This allows nunjucks filters.
* Add globals for first and current year.
* Add filters and clean config file a bit.
* Use smaller functions with a narrower scope.
* Add comments to better explain functions.
Updated `js-yaml` and several dependencies in `package-lock.json` to latest versions, ensuring compatibility and resolving potential integrity issues. Marked additional dependencies with the `peer` attribute for enhanced accuracy.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Rearranged header links in `index.njk` and `year.njk` to ensure consistent navigation functionality. This change improves semantics and aligns the structure of both templates.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Updated the wording for archive URL references in the README to improve clarity. This ensures contributors can more easily understand how to document their participation.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@j9t
Copy link
Member

j9t commented Nov 22, 2025

Finally getting to something here 🙂

Nice work! ❤️

Felt free to address an issue that came up with npm audit.

Also fixed homepage links (had to be flipped so that subpages link back home). There’s still some issue that the main header “jumps” when navigating from homepage to subpages—may be the link, but couldn’t pinpoint it yet.

Quick questions and observations (might be faster to just share here):

  • First, I take it we keep it simple and just look at a migration? (Just confirming, works for me.)

  • The “Add yours” links—do we really want them on each page? Would suggest only to add it for upcoming CSS Naked Days.

  • We had years without participation. Now it seems someone (you @arkhi 🙂) has participated every year. Not doubting this, but are one-participant entries useful—or drop years with, I don’t know, <5 people? I think at such a point the event wasn’t really heeded.

That just as a sign of life—will review again likely tomorrow, and should be much more available now! 🤝

@j9t
Copy link
Member

j9t commented Nov 23, 2025

Quick question, @arkhi—what would work best for you, if I make changes directly, comment in the PR, use good judgment, or no preferences at all?

j9t added 2 commits November 23, 2025 13:22
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@j9t
Copy link
Member

j9t commented Nov 23, 2025

Also fixed homepage links (had to be flipped so that subpages link back home). There’s still some issue that the main header “jumps” when navigating from homepage to subpages—may be the link, but couldn’t pinpoint it yet.

Found the issue (commented web font line), pushed fix.

Tested some more and tweaked a little.

I like the approach of keeping things simple for the migration, for which this iteration looks good. The biggest points on my mind right now are these:

  1. We have some repetition because of lack of a base template. I might just go ahead and templatize the site, but feel free to weigh in if you’re already on this or have other thoughts.

  2. I’d also suggest to minify the HTML. Any thoughts on this? Could take care of this on this branch or later.

Both goes back to the last question though, from which I don’t want to distract 🙂

Quick question, @arkhi—what would work best for you, if I make changes directly, comment in the PR, use good judgment, or no preferences at all?

@arkhi
Copy link
Member Author

arkhi commented Nov 27, 2025

  • First, I take it we keep it simple and just look at a migration? (Just confirming, works for me.)

Yes! The intent is to have eleventy on prod before the end of the year, then we can hack better templates if we want and can.

  • The “Add yours” links—do we really want them on each page? Would suggest only to add it for upcoming CSS Naked Days.

I don’t see any issue with either. The idea being to stay open, it is also very unlikely someone new will forget to add their file, and others can find them easily.

  • We had years without participation. Now it seems someone (you @arkhi 🙂) has participated every year. Not doubting this, but are one-participant entries useful—or drop years with, I don’t know, <5 people? I think at such a point the event wasn’t really heeded.

Fact is the script on my website was on, so the website was actually naked, although I was not putting any effort in it. So, really, it’s just a facts vs. use/harm ratio, I guess. I see no harm, and if that gives a hint that others can join too, I think it’s a good thing. The data is there but we can tweak the templates if necessary, I won’t argue much more about either.

Quick question, @arkhi—what would work best for you, if I make changes directly, comment in the PR, use good judgment, or no preferences at all?

I don’t mind non-opinionated changes to be committed directly. The fixes you did are welcome, thanks! I spent some time on and off on this and it’s easy to miss the issues you spotted right away. The rewriting of some sentences was a bit off-putting but I’ll survive. :)

  • We have some repetition because of lack of a base template. I might just go ahead and templatize the site, but feel free to weigh in if you’re already on this or have other thoughts.

  • I’d also suggest to minify the HTML. Any thoughts on this? Could take care of this on this branch or later.

I’m in favour of both points. I’d rather:

  1. merge this PR,
  2. do a similar one with master to migrate prod,
  3. then improve what can be in another PR.

Spending time optimising if the templates (ideally) change for the 2026 edition is something I’d like to avoid.

@j9t
Copy link
Member

j9t commented Nov 27, 2025

@arkhi, then let’s go! Would not spend more time on this then, either.

Took a few notes for improvements but can take it from there once we merged.

Sorry if any change was surprising—happy if you want to revert or ask me to change anything back, and to chat more. Read everything as friendly and constructive 🙂

@arkhi arkhi merged commit 325757c into staging Nov 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants