forked from EliasMarrow/elias-marrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathessay.html
More file actions
149 lines (126 loc) · 4.43 KB
/
Copy pathessay.html
File metadata and controls
149 lines (126 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Essays — Elias Marrow</title>
<link rel="stylesheet" href="styles.css"/>
</head>
<body class="page-essays">
<div class="container">
<div class="topbar">
<div class="brand">
<div class="sigil">ELIAS MARROW</div>
<div class="motto">Archive</div>
</div>
<div class="nav">
<a href="index.html">Home</a>
<a href="essays.html">Essays</a>
<a href="novels.html">Novels</a>
<a href="about.html">About</a>
</div>
</div>
<div class="panel soft">
<h2>Essays</h2>
<p class="muted">
Evergreen work. Updated deliberately, not frequently.
</p>
<!-- FEATURED ESSAYS -->
<div class="section-card">
<div class="section-title">Featured Essays</div>
<div class="muted">Start here</div>
<div id="featured-essays" class="cover-grid"></div>
</div>
<!-- RECENT ESSAYS -->
<div class="section-card">
<div class="section-title">Recent Essays</div>
<div class="muted">Last 3 publications</div>
<div id="recent-essays" class="cover-grid"></div>
</div>
<!-- ESSAY INDEX -->
<div class="section-card">
<div class="section-title">Essay Index</div>
<div class="muted">Browse by category</div>
<div class="cover-grid">
<div class="ill-card" style="--bgimg:url('assets/category-pillars.jpg')">
<a href="essays-pillars.html">
<h3 class="ill-title">Pillars</h3>
<p class="ill-meta">Foundational essays</p>
</a>
</div>
<div class="ill-card" style="--bgimg:url('assets/category-mechanisms.jpg')">
<a href="essays-mechanisms.html">
<h3 class="ill-title">Mechanisms</h3>
<p class="ill-meta">Incentives, extraction, enforcement</p>
</a>
</div>
<div class="ill-card" style="--bgimg:url('assets/category-applied.jpg')">
<a href="essays-applied.html">
<h3 class="ill-title">Applied Analysis</h3>
<p class="ill-meta">Case-based essays</p>
</a>
</div>
<div class="ill-card" style="--bgimg:url('assets/category-notes.jpg')">
<a href="essays-notes.html">
<h3 class="ill-title">Notes</h3>
<p class="ill-meta">Fragments & short-form</p>
</a>
</div>
</div>
</div>
</div>
<div class="footer">
<div><a href="index.html">Back to Home</a></div>
<div>© <span id="year"></span> Elias Marrow</div>
</div>
</div>
<!-- FEATURED + RECENT ESSAYS SCRIPT -->
<script>
function parseDate(d){
return d ? new Date(d + 'T00:00:00') : new Date(0);
}
function renderCoverCard(essay){
const card = document.createElement('div');
card.className = 'ill-card';
if (essay.cover){
card.style.setProperty('--bgimg', `url("${essay.cover}")`);
}
card.innerHTML = `
<a href="read-me.html?type=essay&id=${essay.id}" rel="noopener">
<h3 class="ill-title">${essay.title}</h3>
${essay.subtitle ? `<p class="ill-meta">${essay.subtitle}</p>` : ``}
</a>
`;
return card;
}
// FIXED: IDs now match content.json exactly
const FEATURED_IDS = [
"the-lens-we-use",
"the-environment-turned-against-us",
"effort-was-held-constant"
];
fetch('content.json')
.then(r => r.json())
.then(data => {
if (!data || !Array.isArray(data.essays)) return;
const byId = new Map(data.essays.map(e => [e.id, e]));
const featuredWrap = document.getElementById('featured-essays');
if (featuredWrap){
FEATURED_IDS
.map(id => byId.get(id))
.filter(Boolean)
.forEach(e => featuredWrap.appendChild(renderCoverCard(e)));
}
const recentWrap = document.getElementById('recent-essays');
if (recentWrap){
data.essays
.filter(e => !FEATURED_IDS.includes(e.id))
.sort((a,b) => parseDate(b.date) - parseDate(a.date))
.slice(0,3)
.forEach(e => recentWrap.appendChild(renderCoverCard(e)));
}
});
document.getElementById("year").textContent = new Date().getFullYear();
</script>
</body>
</html>