lib/App/Dapper/Theme/Portfolio.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 100% 25 / 25 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/App/Dapper/Theme/Docs.pm ↑ Summary
1 package App::Dapper::Theme::Portfolio;
2  
3 =head1 NAME
4  
5 App::Dapper::Theme::Portfolio - A portfolio starter for "dapper init --template portfolio".
6  
7 =head1 DESCRIPTION
8  
9 A home page with an introduction and a grid of projects, a page per project
10 with its image and details, and about and contact pages. Projects live in
11 C<_source/projects/> and must match C<_source/projects/_schema.yml>.
12  
13 =cut
14  
15 190 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 190 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 190 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 190 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 =head2 description
21  
22 A one-line description of the theme.
23  
24 =cut
25  
26 192 ▶sub description { 'A portfolio: a grid of projects with images, and about and contact pages' }
Subroutine description: called CC=1 SCAR=0.0
Pod documented
27  
28 =head2 notes
29  
30 Notes about the theme for AGENTS.md.
31  
32 =cut
33  
34 192 ▶sub notes {
Subroutine notes: called CC=1 SCAR=0.0
Pod documented
35 192 return <<'NOTES';
36 ## About this portfolio
37  
38 - Each project is a Markdown file in `_source/projects/` with `layout: project`,
39 `categories: projects`, a `title`, a `date`, a `description` (one sentence,
40 shown on its card) and an `image` (shown on its card and at the top of its
41 page). `role`, `client` and `link` are optional.
42 - Project images go in `images/` (any format; 1200x800 works well). Every image
43 needs alt text, set with `image_alt`.
44 - The home page (`_source/index.html`) shows every project, newest first.
45 - Contact details and social links are in `_data/profile.yml`.
46 NOTES
47 }
48  
49 =head2 files
50  
51 Returns the theme's files, as a hash of path to content.
52  
53 =cut
54  
55 192 ▶sub files {
Subroutine files: called CC=1 SCAR=0.0
Pod documented
56 return {
57 192 '_config.yml' => <<'FILE',
58 # Dapper configuration file. See https://github.com/markdbenson/dapper
59 ---
60 name: Alex Rivera
61 description: Designer and illustrator making identities, books and posters.
62 author: Alex Rivera
63  
64 # The address the site will be published at, without a trailing slash.
65 url: https://example.com
66  
67 # The default image when the site is shared on social media.
68 image: /images/project-1.svg
69  
70 timezone: America/Chicago
71  
72 # Where "dapper deploy" publishes the site. Uncomment "deploy:" and one
73 # of the targets below. See "Deploying with dapper deploy" in the README.
74 #deploy:
75 # s3:
76 # bucket: example.com
77 # github_pages:
78 # branch: gh-pages
79 # command: rsync -av --delete _output/ me@example.com:/var/www/site/
80 FILE
81  
82 '_data/profile.yml' => <<'FILE',
83 # Shown in the header, the footer and on the contact page (site.data.profile)
84 tagline: Designer and illustrator
85 email: hello@example.com
86 location: Chicago, Illinois
87 links:
88 - label: Instagram
89 url: https://instagram.com/
90 - label: LinkedIn
91 url: https://linkedin.com/
92 FILE
93  
94 '_layout/index.html' => <<'FILE',
95 ---
96 description: The page wrapper used by every page (header, footer, SEO tags)
97 ---
98 <!DOCTYPE html>
99 <html lang="en">
100 <head>
101 <meta charset="utf-8">
102 <meta name="viewport" content="width=device-width, initial-scale=1">
103 <title>[% IF page.title AND page.url != '/' %][% page.title | html %] - [% END %][% site.name | html %]</title>
104 [% page.seo %]
105 <link rel="stylesheet" href="/css/site.css">
106 </head>
107 <body>
108 <a class="skip" href="#main">Skip to content</a>
109 <header class="site-header">
110 <a class="site-name" href="/">[% site.name | html %]</a>
111 <nav aria-label="Main">
112 <a href="/">Work</a>
113 <a href="/about.html">About</a>
114 <a href="/contact.html">Contact</a>
115 </nav>
116 </header>
117 <main id="main">
118 [% page.content %]
119 </main>
120 <footer class="site-footer">
121 <p>&copy; [% site.time.year %] [% site.author | html %]</p>
122 <p>
123 [% FOR link IN site.data.profile.links %]
124 <a href="[% link.url %]">[% link.label | html %]</a>
125 [% END %]
126 </p>
127 </footer>
128 </body>
129 </html>
130 FILE
131  
132 '_layout/project.html' => <<'FILE',
133 ---
134 layout: index
135 description: A project page, with its image, details and write-up
136 ---
137 <article class="project">
138 <header>
139 <h1>[% page.title | html %]</h1>
140 <p class="lede">[% page.description | html %]</p>
141 <dl class="details">
142 [% IF page.client %]
143 <dt>Client</dt><dd>[% page.client | html %]</dd>
144 [% END %]
145 [% IF page.role %]
146 <dt>Role</dt><dd>[% page.role | html %]</dd>
147 [% END %]
148 <dt>Year</dt><dd>[% page.year %]</dd>
149 </dl>
150 </header>
151 <img class="hero" src="[% page.image %]" alt="[% page.image_alt | html %]">
152 <div class="prose">
153 [% page.content %]
154 </div>
155 [% IF page.link %]
156 <p><a class="button" href="[% page.link %]">See the project</a></p>
157 [% END %]
158 <p><a href="/">&larr; All work</a></p>
159 </article>
160 FILE
161  
162 '_source/index.html' => <<'FILE',
163 ---
164 title: Work
165 description: Identities, books and posters by Alex Rivera.
166 template: true
167 ---
168 <section class="intro">
169 <h1>[% site.data.profile.tagline | html %]</h1>
170 <p>[% site.description | html %]</p>
171 </section>
172  
173 <ul class="grid" role="list">
174 [% FOR project IN site.categories.projects.reverse %]
175 <li class="card">
176 <a href="[% project.url %]">
177 <img src="[% project.image %]" alt="[% project.image_alt | html %]" loading="lazy">
178 <h2>[% project.title | html %]</h2>
179 <p>[% project.description | html %]</p>
180 </a>
181 </li>
182 [% END %]
183 </ul>
184 FILE
185  
186 '_source/about.md' => <<'FILE',
187 ---
188 title: About
189 description: About Alex Rivera, a designer and illustrator in Chicago.
190 ---
191  
192 # About
193  
194 I'm Alex, a designer and illustrator in Chicago. I make identities, books and
195 posters for studios, publishers and small businesses.
196  
197 Edit `_source/about.md` to tell visitors who you are, what you do, and who you
198 like working with.
199 FILE
200  
201 '_source/contact.html' => <<'FILE',
202 ---
203 title: Contact
204 description: How to get in touch with Alex Rivera.
205 template: true
206 ---
207 <h1>Contact</h1>
208 <p>I'm taking on new projects. The best way to reach me is by email.</p>
209 <p><a class="button" href="mailto:[% site.data.profile.email %]">[% site.data.profile.email %]</a></p>
210 <p>Based in [% site.data.profile.location | html %].</p>
211 FILE
212  
213 '_source/projects/_schema.yml' => <<'FILE',
214 # Every project must have these. Run "dapper check" to see any problems.
215 required: [title, date, categories, description, image, image_alt]
216 fields:
217 title:
218 type: string
219 max_length: 80
220 date:
221 type: date
222 categories:
223 type: list
224 values: [projects]
225 description:
226 type: string
227 max_length: 160
228 image:
229 type: string
230 pattern: '^/'
231 image_alt:
232 type: string
233 min_length: 5
234 role:
235 type: string
236 client:
237 type: string
238 link:
239 type: string
240 FILE
241  
242 '_source/projects/riverside-books.md' => <<'FILE',
243 ---
244 title: Riverside Books
245 layout: project
246 categories: projects
247 date: 2026-03-01
248 description: A new identity and shop signage for an independent bookshop.
249 image: /images/project-1.svg
250 image_alt: The Riverside Books logo in blue on a cream background
251 client: Riverside Books
252 role: Identity and signage
253 ---
254  
255 Riverside Books wanted to look as welcoming as it feels inside. We built the
256 identity around a hand-drawn river line that wraps the name, and carried it
257 onto the shop sign, bags and bookmarks.
258  
259 Replace this project with your own: change the text, put your image in
260 `images/`, and update the front matter.
261 FILE
262  
263 '_source/projects/night-market.md' => <<'FILE',
264 ---
265 title: Night Market Posters
266 layout: project
267 categories: projects
268 date: 2025-09-15
269 description: A series of posters for a summer night market.
270 image: /images/project-2.svg
271 image_alt: Three posters with lanterns in orange and deep purple
272 client: Westside Night Market
273 role: Illustration
274 ---
275  
276 Three posters for the market's summer season, one for each month, sharing a
277 palette of lantern orange and late-evening purple.
278 FILE
279  
280 'images/project-1.svg' => <<'FILE',
281 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800" role="img" aria-label="Placeholder image"><rect width="1200" height="800" fill="#f3efe6"/><path d="M0 520 C 300 420 500 640 800 520 S 1100 420 1200 480 V800 H0Z" fill="#2f5d8a"/><text x="600" y="380" font-family="Georgia, serif" font-size="96" text-anchor="middle" fill="#2f5d8a">Riverside</text></svg>
282 FILE
283  
284 'images/project-2.svg' => <<'FILE',
285 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800" role="img" aria-label="Placeholder image"><rect width="1200" height="800" fill="#2b1840"/><circle cx="300" cy="320" r="90" fill="#f28c28"/><circle cx="600" cy="260" r="110" fill="#f6a443"/><circle cx="900" cy="330" r="80" fill="#f28c28"/><text x="600" y="620" font-family="Georgia, serif" font-size="88" text-anchor="middle" fill="#f6a443">Night Market</text></svg>
286 FILE
287  
288 'css/site.css' => <<'FILE',
289 :root {
290 --bg: #fbfaf7;
291 --text: #1d1d1f;
292 --muted: #5f5f66;
293 --accent: #2f5d8a;
294 --card: #ffffff;
295 --border: #e6e2d9;
296 }
297 @media (prefers-color-scheme: dark) {
298 :root {
299 --bg: #121214;
300 --text: #ececef;
301 --muted: #a3a3ad;
302 --accent: #8fb8e6;
303 --card: #1c1c20;
304 --border: #2c2c33;
305 }
306 }
307 * { box-sizing: border-box; }
308 body {
309 margin: 0;
310 background: var(--bg);
311 color: var(--text);
312 font: 18px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
313 }
314 a { color: var(--accent); }
315 a:focus-visible, .button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
316 .skip { position: absolute; left: -999px; }
317 .skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .5rem 1rem; }
318 .site-header, main, .site-footer { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
319 .site-header { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: baseline; padding-top: 1.5rem; padding-bottom: 2rem; }
320 .site-name { font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; }
321 .site-header nav { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
322 .site-header nav a { color: var(--text); text-decoration: none; }
323 .site-header nav a:hover { color: var(--accent); }
324 .intro { max-width: 40rem; margin-bottom: 2.5rem; }
325 .intro h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.1; margin: 0 0 .5rem; }
326 .intro p { color: var(--muted); font-size: 1.15rem; margin: 0; }
327 .grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
328 .card a { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; color: var(--text); text-decoration: none; transition: transform .15s ease; }
329 .card a:hover { transform: translateY(-3px); }
330 .card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
331 .card h2 { font-size: 1.15rem; margin: 1rem 1rem .25rem; }
332 .card p { color: var(--muted); margin: 0 1rem 1.25rem; font-size: .95rem; }
333 .project header { max-width: 44rem; }
334 .project h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.15; margin-bottom: .25rem; }
335 .lede { color: var(--muted); font-size: 1.2rem; margin-top: 0; }
336 .details { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; color: var(--muted); }
337 .details dt { font-weight: 600; color: var(--text); }
338 .details dd { margin: 0; }
339 .hero { display: block; width: 100%; border-radius: 12px; margin: 2rem 0; }
340 .prose { max-width: 44rem; }
341 .button { display: inline-block; background: var(--accent); color: var(--bg); padding: .6rem 1.2rem; border-radius: 8px; text-decoration: none; font-weight: 600; }
342 .site-footer { margin-top: 4rem; padding-top: 1.5rem; padding-bottom: 2rem; border-top: 1px solid var(--border); color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; }
343 .site-footer a { margin-left: 1rem; color: var(--muted); }
344 FILE
345 };
346 }
347  
348 190 1;
« lib/App/Dapper/Theme/Docs.pm ↑ Summary