Hi!
I'm trying to programmatically generate tag pages instead of manually creating them.
I am making a log of reviews of wrestling matches. Each review has a wrestler metadata attribute and tags. I'll start with the wrestlers because it's slightly more complicated, involving each wrestler being tagged with a name and a slug.
I want the process to be:
1. Compile pages
2. Check if page has @item[:wrestlers]
3. If it does, find all pages in the /wrestler/ subdirectory
4. Loop through each wrestler listed in the review data, which has wrestler[:name] and wrestler[:slug]
5. If /wrestler/wrestler[:slug] exists, move on to next wrestler[:slug]
6. If /wrestler/wrestler[:slug] does not exist, create new file /wrestler/wrestler[:slug], which populates metadata headers with wrestler[:name] and wrestler[:slug], then move on to next wrestler
However, I can't seem to get the checking an array portion to match things properly:
if @item[:wrestlers]
wrestlers = @items.find_all('/interests/pro-wrestling/match-log/wrestler/*.md')
@item[:wrestlers].each do | wrestler |
puts wrestler[:slug]
if wrestlers.include?(wrestler[:slug])
puts "Tag page exists"
else
puts "Tag page not found"
end
end
end
Sample review header:
---
title: "Komander vs. Ariya Daivari"
layout: "/wrestling.*"
template: "match-log"
wrestlers:
- name: "Komander"
slug: "komander"
- name: "Ariya Daivari"
slug: "ariya-daivari"
promotions:
- "ROH"
event_name: "ROH YouTube Special Episode #13"
event_date: 2026-08-18
date_watched: 2026-08-18
is_rewatch: false
rewatch_number:
rating: "⭐️⭐️⭐️"
rating_numerical: 3.0
tags:
breadcrumbs:
- label: "Home"
url: "/"
- label: "Interests"
url: "/interests/"
- label: "Professional Wrestling"
url: "/interests/pro-wrestling/"
- label: "Match Log"
url: "/interests/pro-wrestling/match-log/"
---
The template for each wrestler page, where NAME and SLUG are to be auto-populated, and layouting will be handled automatically to collate reviews:
---
title: "Match Log: NAME"
layout: "/wrestling.*"
wrestler: "SLUG"
template: "match-log-wrestler"
breadcrumbs:
- label: "Home"
url: "/"
- label: "Interests"
url: "/interests/"
- label: "Professional Wrestling"
url: "/interests/pro-wrestling/"
- label: "Match Log"
url: "/interests/pro-wrestling/match-log/"
- label: "Wrestlers"
url: "/interests/pro-wrestling/match-log/wrestler/"
breadcrumb_label: "NAME"
---
Please let me know if there's anything else I should provide or any further explanation that would clarify this.
Thanks so much!
S.