Skip to content
Design system
v1.0
Tier 1, Marathon to the world

Social feed posts

Confirmed

1080 by 1080 and 1080 by 1350 posts that keep the listing photo as the hero.

Champion r04Confirmed in r04Repo folder build/social-feed/v/best/
Social feed posts, primary render

Primary render. Select it to open full size.

Renders

Every render from the champion round

Showing 40 of 215 renders. The rest are in build/social-feed/v/best/renders/.

Rules

How to use it, from the piece README

Marathon's own feed post templates at 1080x1080 and 1080x1350. Five templates, one file:

TemplatetplLayoutUse it for
Just listed or just shotlistingFull bleed photo, navy scrim, three cell fact rowResidential, land, commercial, and industrial shoots and listings
Behind the scenesbtsFull bleed photo, navy scrim, up to three service iconsShoot days, sets, process
ResultstatPhoto on top, navy panel with one big numberOne client result, with the client named
AnnouncementannouncePhoto on top, white panel, navy buttonNew service, booking window, news
HiringhiringPhoto on top, navy panel, three lines and a buttonOpen roles

Make a post

  1. Open posts.json. Copy an existing post, give it a new key.
  2. Set tpl, then photo to a key from the photos list. Photos come only from brief/real-photos/, copied into photos/. Any other value is refused and the post keeps its default photo.
  3. Type the copy. Limits are on usage.html, page one, printable.
  4. Run python3 build_posts.py in this folder.
  5. Open post.html?id=yourkey&size=square&check=1 in Chrome. The panel on the right lists everything the template cut, shrank, or dropped. If it lists anything, rewrite shorter. Use size=portrait for 1080x1350.
  6. Export from the repo root: node build/social-feed/v/r04/render_all.mjs renders every post into renders/. For one post, node build/_shared/render.mjs png 'build/social-feed/v/r04/post.html?id=yourkey&size=square' out.png 1080 1080 0.

Quick edits work in the URL too, no JSON needed: &headline=..., &eyebrow=..., &sub=..., &credit=..., &stat=..., &stat_label=..., &cta=..., &f1=1.9|Acres to &f3=, &i1= to &i3= for hiring lines, &services=photography,video,drone, &photo=mc_rosehill_16, and &focus=50,40 to move the crop.

What the template does for you

  • Copy limits. Every field has a character cap, a line budget, and a size range. Copy first shrinks, then is cut at a whole word. A single word longer than the cap is cut with a visible ellipsis, never silently.
  • Figures are never rounded or cut. The stat and fact numbers print exactly as typed, up to 11 characters. $1,250,000 and 1234567890 stack above their label at full width, digit for digit. Anything longer, or too wide at the smallest size, is refused: the slot shows a dashed "Figure refused, see copy check" plate, the page gets data-refused="1", and the check panel says why. Type the short form the client approved, for example $1.25M, yourself. The only change the template makes to a figure is dropping a trailing unit word, as in 12,400 sq ft to 12,400, and it reports that. An overlong eyebrow falls back to the template's own label.
  • Long words. Every wrapping field is measured for width as well as line count. A word wider than the margin, like a pasted URL, shrinks the field to 72% of its smallest size, then breaks with a hyphen at the margin. The stat label skips the shrink and breaks, at full width when it sits under a stacked number. The button label wraps to two lines and uses the same fallback, so a long word or URL breaks with a hyphen inside the button instead of running out of it. The check panel reports both steps.
  • Zone limits. If the copy block is still too tall, fields give way in a fixed order, listed on the usage sheet.
  • Photo rules. Type sits only on the 64% to 82% navy scrim or a solid panel. The logo always sits on a solid navy tab or a panel, never on the photo. A photo with a drawn lot boundary (mc_fullres_10 to 15) or with people in it (mc_retouched_01) switches the full bleed templates to a split layout on its own, so no scrim, type, or red bar covers the line or a face.
  • Listing facts. Three cells, typed per asset. There is no bed and bath field. Use the fact rows on the usage sheet.

Files

FileWhat it is
post.html, post.css, post.jsThe template. post.js holds every limit in one place.
posts.jsonThe fill file. posts.js is generated from it by build_posts.py, never edit it by hand.
icons-inline.jsService icons copied from the icon set by build_icons.py.
usage.htmlThe one page usage sheet. Its limit tables are read from post.js.
render_all.mjs, sheets.pyRender every post and the contact sheets.
photos/Copies of the 18 library photos.

Tokens, fonts, and logos load from ../../../tokens/v/best/. To use this in an app or another folder, copy tokens.css, fonts/, and logos/ next to it and update the three paths. Never hotlink.

Renders

  • renders/primary.png, every template at both sizes.
  • renders/photo-interior.png, photo-aerial.png, photo-portrait.png, photo-boundary.png, every template on the same tight interior, wide aerial, portrait original, and red boundary aerial.
  • renders/stress-square.png, stress-portrait.png, copy twice as long as allowed on the brightest, busiest, tallest, and boundary photos. renders/stress/*-check.png show the engine's report beside each one.
  • renders/longword-square.png, longword-portrait.png, a 34 letter word and a 55 character URL typed through &headline= (or &stat_label= on the result post), on a tight interior, a wide aerial, and a portrait original. renders/longword/check-listing-*-url.png show the engine's report.
  • renders/edge-square.png, edge-portrait.png, long words in the stat label (beside and stacked) and the button, $1,250,000 and 1234567890 printed as typed, and $1,250,000,000 refused in the stat and in a fact cell. edge-check-*.png show the same posts with the engine report.
  • renders/usage.pdf and renders/usage/p01.png, the usage sheet.

For Jacob to confirm

Every figure in the sample posts is a working value, flagged in that post's _confirm field: the 38% Rosehill result, $289K, 1,850 sq ft, 12 acres of parks, 400 ft, the 1.9 acre lot, 310 ft of frontage, 64 stills, the 40 ft wall, the 48 hour Zillow Showcase window, and the careers URL.

Use it

Files to download and code to copy

  • Whole piece, source files30 files, zip, 17.6 MB. Paths inside follow the repo layout, so put tokens.css beside them as the README says.
    Download
  • usage.pdfPDF, 4.1 MB
    Download

Copy-paste code

post.css142 lines, 10.7 KB
/* Marathon feed post templates. Every colour, weight, and safe area comes from tokens.css.
   Social type sizes are set here in px because the canvas is a fixed 1080 wide.
   post.js owns the copy limits and sets the final font sizes inside the ranges below. */

html, body { margin: 0; padding: 0; background: var(--mc-surface-muted); }
body { font-family: var(--mc-font); -webkit-font-smoothing: antialiased; }
.stage { display: flex; align-items: flex-start; gap: var(--mc-space-08); }

.post {
  --w: var(--mc-social-square-w); --h: var(--mc-social-square-h);
  --safe-top: var(--mc-social-square-safe-top); --safe-bottom: var(--mc-social-square-safe-bottom);
  --safe-side: var(--mc-social-square-safe-side);
  --logo-h: 48px; --m-height: calc(var(--logo-h) * 0.432);
  --bar-w: 60px; --bar-h: 6px;
  position: relative; overflow: hidden; flex: none;
  width: var(--w); height: var(--h);
  background: var(--mc-surface-inverse); color: var(--mc-text-inverse);
  font-family: var(--mc-font);
}
.post.portrait {
  --w: var(--mc-social-portrait-w); --h: var(--mc-social-portrait-h);
  --safe-top: var(--mc-social-portrait-safe-top); --safe-bottom: var(--mc-social-portrait-safe-bottom);
  --safe-side: var(--mc-social-portrait-safe-side);
}

/* The photo. Always cover, never stretched, focus set per photo in posts.json. */
.photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* Logo tab. Solid navy, hangs from the top edge, clear space equals the M height. The logo never touches a photo. */
.tab { position: absolute; top: 0; left: var(--safe-side); z-index: 3; background: var(--mc-surface-inverse); padding: var(--m-height); line-height: 0; }
.tab img { height: var(--logo-h); width: auto; display: block; }

/* Shared type */
.eyebrow { margin: 0; font-size: 24px; font-weight: var(--mc-type-eyebrow-weight); letter-spacing: var(--mc-type-eyebrow-tracking);
  text-transform: var(--mc-type-eyebrow-case); line-height: 1.2; color: var(--mc-text-inverse); }
.bar { display: block; width: var(--bar-w); height: var(--bar-h); background: var(--mc-accent-on-inverse); margin: var(--mc-space-06) 0 var(--mc-space-07); }
.headline { margin: 0; font-size: 80px; font-weight: var(--mc-type-h1-weight); letter-spacing: var(--mc-type-h1-tracking);
  line-height: 1.08; text-wrap: balance; color: var(--mc-text-inverse); }
.sub { margin: var(--mc-space-06) 0 0; font-size: 30px; font-weight: var(--mc-weight-regular); line-height: 1.4; color: var(--mc-text-inverse); max-width: 860px; }
.credit { margin: var(--mc-space-05) 0 0; font-size: 24px; font-weight: var(--mc-weight-semibold); line-height: 1.3; color: var(--mc-text-inverse-secondary); }

/* Scrim A, base fade. The scrim is the background of the copy block, so longer copy pulls it up.
   82% at the bottom edge, 64% at the first line of type, 0% one fade length above. */
.scrim {
  --fade: 168px;
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: calc(var(--fade) + var(--mc-space-04)) var(--safe-side) var(--safe-bottom);
  background: linear-gradient(to top,
    var(--mc-scrim-photo-strong) 0%,
    var(--mc-scrim-photo) calc(100% - var(--fade)),
    var(--mc-scrim-photo-clear) 100%);
}

/* Fact row, listing only. Three cells, any asset type. The engine never invents a bed or bath cell. */
.facts { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: var(--mc-space-08);
  margin-top: var(--mc-space-07); padding-top: var(--mc-space-07); border-top: var(--mc-border-width-hairline) solid var(--mc-border-inverse); }
.fact { min-width: 0; }
.fact b { display: block; font-size: 52px; font-weight: var(--mc-weight-bold); line-height: 1.05; letter-spacing: -0.01em;
  font-variant-numeric: var(--mc-numeric-tabular); white-space: nowrap; overflow: hidden; color: var(--mc-text-inverse); }
.fact span { display: block; margin-top: var(--mc-space-03); font-size: 18px; font-weight: var(--mc-weight-bold); letter-spacing: 0.14em;
  text-transform: uppercase; line-height: 1.25; color: var(--mc-text-inverse-secondary); }

/* Service row, behind the scenes only. Icons come from the shared icon set, on the scrim, white. */
.services { display: flex; flex-wrap: nowrap; gap: var(--mc-space-08); margin-top: var(--mc-space-07); padding-top: var(--mc-space-07);
  border-top: var(--mc-border-width-hairline) solid var(--mc-border-inverse); }
.svc { display: flex; align-items: center; gap: var(--mc-space-04); font-size: 20px; font-weight: var(--mc-weight-bold);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--mc-text-inverse); white-space: nowrap; }
.svc .mc-icon { --mc-icon-display-size: 44px; color: var(--mc-text-inverse); }

/* Panel templates: photo on top, solid panel below. No type ever touches the photo. */
.media { position: absolute; left: 0; right: 0; top: 0; height: var(--media-h); overflow: hidden; }
.panel { position: absolute; left: 0; right: 0; bottom: 0; top: var(--media-h); display: flex; flex-direction: column;
  padding: var(--mc-space-10) var(--safe-side) var(--safe-bottom); box-sizing: border-box; background: var(--mc-surface-inverse); }
.panel .body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.panel .foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--mc-space-08); margin-top: var(--mc-space-07); }
.panel .foot img { height: 40px; width: auto; display: block; flex: none; margin-left: auto; }
.panel .foot .url { font-size: 22px; font-weight: var(--mc-weight-bold); letter-spacing: 0.02em; color: var(--mc-text-inverse); min-width: 0; white-space: nowrap; overflow: hidden; }
.panel .bar { margin: var(--mc-space-05) 0 var(--mc-space-06); }

.tpl-stat { --media-h: 560px; }
.tpl-stat.portrait { --media-h: 750px; }
.tpl-hiring { --media-h: 440px; }
.tpl-hiring.portrait { --media-h: 640px; }
.tpl-announce { --media-h: 520px; }
.tpl-announce.portrait { --media-h: 720px; }

/* Stat. The number is the headline. */
.statrow { display: flex; align-items: flex-end; gap: var(--mc-space-08); }
.stat { margin: 0; flex: none; font-size: 200px; font-weight: var(--mc-type-stat-weight); letter-spacing: var(--mc-type-stat-tracking);
  line-height: 0.9; font-variant-numeric: var(--mc-numeric-tabular); white-space: nowrap; color: var(--mc-text-inverse); }
.stat_label { margin: 0 0 var(--mc-space-02); flex: 1 1 0; min-width: 0; font-size: 36px; font-weight: var(--mc-weight-semibold); line-height: 1.2; color: var(--mc-text-inverse); }
.statrow.stacked { flex-direction: column; align-items: flex-start; gap: var(--mc-space-04); }
/* Stacked, the label takes the full row width so post.js measures a too long word against the real margin. */
.statrow.stacked .stat_label { align-self: stretch; flex: none; width: 100%; }
.tpl-stat .credit { margin-top: 0; }

/* Hiring. Three plain lines with a check, no paragraphs. */
.items { list-style: none; margin: var(--mc-space-07) 0 0; padding: 0; display: grid; gap: var(--mc-space-04); }
.items li { display: flex; align-items: flex-start; gap: var(--mc-space-04); font-size: 28px; font-weight: var(--mc-weight-regular); line-height: 1.3; color: var(--mc-text-inverse); }
.items li .mc-icon { --mc-icon-display-size: 30px; margin-top: 3px; color: var(--mc-accent-on-inverse); }
.items li span { min-width: 0; }
.tpl-hiring .headline { font-size: 64px; }

/* Announcement. White panel, Marathon Red on white, navy headline, dark logo. */
.tpl-announce .panel { background: var(--mc-surface-page); color: var(--mc-text-primary); }
.tpl-announce .eyebrow { color: var(--mc-text-label); }
.tpl-announce .bar { background: var(--mc-accent); }
.tpl-announce .headline { color: var(--mc-text-heading); font-size: 68px; }
.tpl-announce .sub { color: var(--mc-text-secondary); font-size: 28px; }
.cta { display: inline-flex; align-items: center; gap: var(--mc-space-04); min-width: 0; max-width: 640px; box-sizing: border-box; background: var(--mc-action-primary); color: var(--mc-action-primary-text);
  font-size: 24px; font-weight: var(--mc-weight-bold); line-height: 1.2; padding: var(--mc-space-05) var(--mc-space-07); border-radius: var(--mc-radius-sm); }
/* The label wraps to two lines at most. post.js fits it and breaks a too long word with a hyphen at the button edge. */
.cta .cta-label { flex: 0 1 auto; min-width: 0; white-space: normal; hyphens: manual; overflow-wrap: normal; }
.cta .mc-icon { --mc-icon-display-size: 26px; flex: none; }
.tpl-hiring .cta { background: var(--mc-action-inverse); color: var(--mc-action-inverse-text); }

/* Refused figure. Set by post.js when a stat or fact number cannot be shown exactly as typed.
   It is meant to look unpublishable: the template never rounds or cuts a figure to make it fit. */
.post .refused { font-size: 28px; font-weight: var(--mc-weight-bold); letter-spacing: 0; line-height: 1.3; white-space: normal;
  padding: var(--mc-space-04) var(--mc-space-05); outline: var(--mc-border-width-strong) dashed var(--mc-status-warning); outline-offset: -2px; }
.fact b.refused { font-size: 18px; }

/* Guides, only with &guides=1 */
.guides { position: absolute; z-index: 9; pointer-events: none; top: var(--safe-top); bottom: var(--safe-bottom); left: var(--safe-side); right: var(--safe-side);
  outline: var(--mc-border-width-strong) dashed var(--mc-status-warning); }

/* Check report, only with &check=1 */
.report { width: 400px; flex: none; padding: var(--mc-space-07); box-sizing: border-box; background: var(--mc-surface-page); color: var(--mc-text-primary);
  font-size: 17px; line-height: 1.45; border-top: var(--mc-border-width-bar) solid var(--mc-border-accent); }
.report h2 { margin: 0 0 var(--mc-space-03); font-size: 14px; font-weight: var(--mc-weight-bold); letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; color: var(--mc-text-label); }
.report p { margin: 0 0 var(--mc-space-05); color: var(--mc-text-heading); font-weight: var(--mc-weight-bold); font-size: 20px; }
.report ol { margin: 0; padding-left: var(--mc-space-07); }
.report li { margin-bottom: var(--mc-space-03); overflow-wrap: anywhere; }
.report .ok { color: var(--mc-status-success); font-weight: var(--mc-weight-semibold); }

/* Split layout for full bleed templates on a photo with a drawn boundary. Set by post.js, never by hand. */
.post.split { --media-h: 520px; }
.post.split.portrait { --media-h: 740px; }
.splitpanel { position: absolute; left: 0; right: 0; bottom: 0; top: var(--media-h); z-index: 2; overflow: hidden; box-sizing: border-box;
  padding: var(--mc-space-10) var(--safe-side) var(--safe-bottom); background: var(--mc-surface-inverse); }
.splitpanel .bar { margin: var(--mc-space-05) 0 var(--mc-space-06); }
post.html25 lines, 882 bytes
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1080">
<title>Marathon feed post</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="../../../icons/v/best/icons.css">
<link rel="stylesheet" href="post.css">
</head>
<body>
<!-- One template file for all five feed posts.
     post.html?id=<key in posts.json>&size=square or &size=portrait
     Any field can be overridden in the URL, for example &photo=mc_rosehill_16&headline=Your+line
     Add &check=1 to see what the engine cut, shrank, or dropped. Add &guides=1 to see the safe areas. -->
<div class="stage">
  <div id="post" class="post"></div>
  <aside id="report" class="report" hidden></aside>
</div>
<script src="icons-inline.js"></script>
<script src="posts.js"></script>
<script src="post.js"></script>
</body>
</html>
usage.html142 lines, 10.4 KB
<!doctype html>
<html lang="en" data-limits-only>
<head>
<meta charset="utf-8">
<title>Feed post usage sheet, Marathon Creative</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<style>
  @page { size: 8.5in 11in; margin: 0; }
  html, body { margin: 0; background: var(--mc-surface-page); }
  body { font-family: var(--mc-font); color: var(--mc-text-primary); font-size: 8.2pt; line-height: 1.38; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page { position: relative; width: var(--mc-doc-page-width); height: var(--mc-doc-page-height); box-sizing: border-box; overflow: hidden;
    padding: 0.55in var(--mc-doc-margin-side) var(--mc-doc-margin-bottom); }
  .top { display: flex; justify-content: space-between; align-items: flex-start; }
  .top img { height: 0.3in; }
  .eyebrow { margin: 0; font-size: var(--mc-print-type-eyebrow-size); font-weight: var(--mc-weight-bold); letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; color: var(--mc-text-label); }
  h1 { margin: 4pt 0 0; font-size: 18pt; font-weight: var(--mc-weight-extrabold); letter-spacing: var(--mc-type-h1-tracking); line-height: 1.1; color: var(--mc-text-heading); text-wrap: balance; }
  .divider { width: var(--mc-doc-divider-width); height: var(--mc-doc-divider-height); background: var(--mc-border-accent); margin: 7pt 0 7pt; }
  .lede { margin: 0; font-size: 9pt; font-weight: var(--mc-weight-light); line-height: 1.4; color: var(--mc-text-secondary); max-width: 6.6in; }
  .grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--mc-doc-gutter); }
  .c7 { grid-column: span 7; } .c5 { grid-column: span 5; } .c12 { grid-column: span 12; } .c6 { grid-column: span 6; }
  h2 { margin: 9pt 0 4pt; font-size: 10.5pt; font-weight: var(--mc-weight-bold); color: var(--mc-text-heading); }
  table { width: 100%; border-collapse: collapse; font-size: 7.4pt; }
  th { background: var(--mc-surface-table-header); color: var(--mc-text-on-accent); text-align: left; font-weight: var(--mc-weight-bold); padding: 3pt 4pt; }
  td { padding: 2pt 4pt; border-bottom: var(--mc-border-width-hairline) solid var(--mc-border-subtle); vertical-align: top; }
  tbody tr:nth-child(even) td { background: var(--mc-surface-row-alt-print); }
  .num { text-align: right; font-variant-numeric: var(--mc-numeric-tabular); white-space: nowrap; }
  .k { font-weight: var(--mc-weight-semibold); color: var(--mc-text-heading); white-space: nowrap; }
  ol, ul { margin: 0; padding-left: 12pt; } li { margin-bottom: 2pt; }
  code { font-family: var(--mc-font); font-weight: var(--mc-weight-semibold); color: var(--mc-text-heading); background: var(--mc-surface-muted); padding: 0 2pt; }
  .callout { background: var(--mc-surface-inverse); color: var(--mc-text-inverse); padding: 7pt 9pt; margin-top: 9pt; }
  .callout b { color: var(--mc-text-inverse); }
  .callout .eyebrow { color: var(--mc-accent-on-inverse); margin-bottom: 3pt; }
  .editor { border: var(--mc-border-width-hairline) solid var(--mc-border-strong); border-left: var(--mc-border-width-bar) solid var(--mc-status-warning); padding: 6pt 8pt; margin-top: 9pt; font-size: 7.4pt; }
  .editor .eyebrow { color: var(--mc-text-heading); margin-bottom: 2pt; }
  .thumbs { display: flex; gap: 6pt; margin-top: 4pt; }
  .thumbs figure { margin: 0; flex: none; width: 1.3in; } .thumbs img { width: 100%; display: block; } .thumbs figcaption { font-size: 6.6pt; color: var(--mc-text-tertiary); margin-top: 2pt; }
  .foot { position: absolute; left: var(--mc-doc-margin-side); right: var(--mc-doc-margin-side); bottom: var(--mc-doc-footer-offset);
    display: flex; justify-content: space-between; font-size: 7pt; font-weight: var(--mc-weight-semibold); color: var(--mc-text-tertiary); letter-spacing: 0.08em; text-transform: uppercase; }
</style>
</head>
<body>
<div class="page">
  <div class="top">
    <div>
      <p class="eyebrow">Social feed posts, usage sheet</p>
      <h1>Fill the post. The template enforces the limits.</h1>
    </div>
    <img src="../../../tokens/v/best/logos/marathon-logo-dark.svg" alt="Marathon Creative">
  </div>
  <div class="divider"></div>
  <p class="lede">Five templates, one file, 1080x1080 and 1080x1350. Pick the template, pick a photo from the library, type the copy. If the copy runs long, the template cuts, shrinks, or drops it in a fixed order, and tells you what it did.</p>

  <div class="grid">
    <div class="c7">
      <h2>Copy limits, per field</h2>
      <table id="limits"><thead><tr><th>Field</th><th class="num">Max chars</th><th class="num">Lines</th><th class="num">Size, px</th><th>Write it like this</th></tr></thead><tbody></tbody></table>
      <h2>When the copy block is still too tall</h2>
      <table id="drop"><thead><tr><th>Template</th><th>What gives way, in order</th></tr></thead><tbody></tbody></table>
    </div>
    <div class="c5">
      <h2>How to make a post</h2>
      <ol>
        <li>Open <code>posts.json</code>, copy a post, give it a new key.</li>
        <li>Set <code>tpl</code> to listing, bts, stat, announce, or hiring.</li>
        <li>Set <code>photo</code> to a key from the photo list. Any other value is refused.</li>
        <li>Run <code>python3 build_posts.py</code>.</li>
        <li>Open <code>post.html?id=yourkey&amp;size=square&amp;check=1</code>. Read the check panel. If it lists a cut, rewrite shorter, the cut is a safety net, not the copy.</li>
        <li>Export at 1080 wide with <code>render_all.mjs</code> or the shared renderer.</li>
      </ol>
      <div class="callout">
        <p class="eyebrow">Locked in the template</p>
        <b>The logo</b> sits on its navy tab or the panel. <b>Type</b> never touches raw photo, only the 64% scrim or a solid panel. <b>Boundary or people photos</b> switch to the split layout on their own, so nothing covers a drawn lot line or a face. <b>A long word</b> wider than the margin shrinks to <span id="floorpct"></span>% of the field's smallest size, then breaks with a hyphen at the margin. The stat label and button skip the shrink and break. <b>Figures</b> print as typed or are refused, never rounded. <b>Red</b> is the 60px bar only.
      </div>
      <h2>Listing fact row, three cells, by asset type</h2>
      <table><thead><tr><th>Asset</th><th>Cell one, two, three</th></tr></thead><tbody>
        <tr><td class="k">Residential</td><td>Price, square feet, lot size</td></tr>
        <tr><td class="k">Land</td><td>Acres, frontage, utilities</td></tr>
        <tr><td class="k">Commercial</td><td>Available sq ft, lease rate, traffic count</td></tr>
        <tr><td class="k">Industrial</td><td>Sq ft, clear height, dock doors</td></tr>
        <tr><td class="k">Just shot</td><td>Stills, shoot days, deliverable</td></tr>
      </tbody></table>
      <p style="margin:3pt 0 0;font-size:7pt;color:var(--mc-text-tertiary)">Beds and baths are a detail for the caption, never a cell.</p>
    </div>
  </div>

  <div class="grid">
    <div class="c7">
      <h2>Copy twice as long as allowed</h2>
      <div class="thumbs">
        <figure><img src="renders/stress/stress-listing-square-bright.png" alt="Listing post with double length copy on white marble"><figcaption>Listing on white marble</figcaption></figure>
        <figure><img src="renders/stress/stress-stat-square-busy.png" alt="Result post with a six figure stat on an aerial"><figcaption>Result, $147,800 stacks</figcaption></figure>
        <figure><img src="renders/stress/stress-bts-square-boundary.png" alt="Behind the scenes post on a boundary aerial, split layout"><figcaption>Boundary photo, auto split</figcaption></figure>
      </div>
    </div>
    <div class="c5">
      <div class="editor">
        <p class="eyebrow">Editor note, Jacob to confirm</p>
        Every figure in the sample posts is a working value and is flagged in its <code>_confirm</code> field: the 38% Rosehill result, $289K and 1,850 sq ft, the 1.9 acre lot, 64 stills, the 48 hour Zillow Showcase window, and the careers URL. Confirm or replace before any of them posts.
      </div>
    </div>
  </div>

  <div class="foot"><span>Social feed posts, usage sheet, v1.0</span><span>1</span></div>
</div>
<script src="post.js"></script>
<script>
(function () {
  var M = window.MC_LIMITS, L = M.LIMITS;
  var names = { eyebrow: 'Eyebrow', headline: 'Headline', sub: 'Sub line', credit: 'Credit', factValue: 'Fact number', factLabel: 'Fact label',
    stat: 'Stat number', stat_label: 'Stat label', item: 'Hiring line', cta: 'Button' };
  var tb = document.querySelector('#limits tbody');
  Object.keys(L).forEach(function (k) {
    var s = L[k], tr = document.createElement('tr');
    [names[k] || k, s.chars, s.lines, s.min + ' to ' + s.max, s.note].forEach(function (v, i) {
      var td = document.createElement('td'); td.textContent = v; if (i === 0) td.className = 'k'; if (i > 0 && i < 4) td.className = 'num'; tr.appendChild(td);
    });
    tb.appendChild(tr);
  });
  var counts = document.createElement('tr');
  ['Counts', '', '', '', 'Facts ' + M.COUNTS.facts + ', services ' + M.COUNTS.services + ', hiring lines ' + M.COUNTS.items + '. Extras are dropped.'].forEach(function (v, i) {
    var td = document.createElement('td'); td.textContent = v; if (i === 0) td.className = 'k'; counts.appendChild(td); });
  tb.appendChild(counts);
  document.getElementById('floorpct').textContent = Math.round(M.FLOOR * 100);
  var label = { listing: 'Listing', bts: 'Behind the scenes', stat: 'Result', announce: 'Announcement', hiring: 'Hiring' };
  var db = document.querySelector('#drop tbody');
  Object.keys(M.DROP).forEach(function (t) {
    var steps = M.DROP[t].map(function (st) {
      var f = (names[st[1]] || st[1] || '').toLowerCase();
      if (st[0] === 'lines') return f + ' to ' + st[2] + ' line' + (st[2] > 1 ? 's' : '');
      if (st[0] === 'hide') return 'drop the ' + f;
      if (st[0] === 'count') return 'hiring lines to ' + st[2];
      return st[0];
    });
    if (t === 'stat') steps.unshift('a wide number stacks above its label');
    var tr = document.createElement('tr'), a = document.createElement('td'), b = document.createElement('td');
    a.textContent = label[t]; a.className = 'k'; b.textContent = steps.join(', then ') + '.'; tr.appendChild(a); tr.appendChild(b); db.appendChild(tr);
  });
})();
</script>
</body>
</html>
icons-inline.js38 lines, 3.3 KB
/* GENERATED by build_icons.py from ../../../icons/v/best/svg. Do not edit by hand. */
window.MC_ICONS = {
 "photography": "<path d=\"M3 9a2 2 0 0 1 2-2h3l1.5-3h5L16 7h3a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/><circle cx=\"12\" cy=\"13.5\" r=\"3.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M17.5 10.5h1\"/>",
 "video": "<rect x=\"2\" y=\"6\" width=\"13\" height=\"12\" rx=\"2\"/><path d=\"M15 10l6-3v10l-6-3\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M5.5 9.5h2\"/>",
 "drone": "<path d=\"M2 6h7M15 6h7\"/><path d=\"M5.5 6v3h13V6\"/><path d=\"M8.5 9v3a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2V9\"/><circle cx=\"12\" cy=\"19\" r=\"2\"/>",
 "tour-3d": "<path d=\"M12 3l8.5 4.5v9.5L12 21.5 3.5 17V7.5z\"/><path d=\"M3.5 7.5L12 12l8.5-4.5M12 12v9.5\"/>",
 "floorplan": "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M3 12h5M12 12h9M12 3v5M12 12v9\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M8 12a4 4 0 0 1 4-4\"/>",
 "headshots": "<path d=\"M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5\"/><circle cx=\"12\" cy=\"10\" r=\"3\"/><path d=\"M7 18a5 4 0 0 1 10 0\"/>",
 "strategy": "<circle cx=\"5.5\" cy=\"18\" r=\"2.5\"/><path d=\"M8 18h7a3 3 0 0 0 0-6H9a3 3 0 0 1 0-6h7\"/><circle cx=\"18.5\" cy=\"6\" r=\"2.5\"/>",
 "social": "<path d=\"M6 3h12a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-7l-5 4.5V16a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M12 12.5L9.2 9.8a1.75 1.75 0 0 1 2.8-2.1 1.75 1.75 0 0 1 2.8 2.1z\"/>",
 "paid-ads": "<path d=\"M3 9h5l9-5v16l-9-5H3z\"/><path d=\"M7 15l1.5 5.5h3L10 15.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M20.5 9.5v5\"/>",
 "email-sms": "<path d=\"M12 15H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2v2\"/><path d=\"M2.8 4.2L10.5 10l7.7-5.8\"/><rect x=\"14\" y=\"9\" width=\"7\" height=\"12\" rx=\"2\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M17 18h1\"/>",
 "crm": "<rect x=\"3\" y=\"3\" width=\"6\" height=\"6\" rx=\"1\"/><circle cx=\"18\" cy=\"6\" r=\"3\"/><rect x=\"15\" y=\"15\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M9 6h6M18 9v6M6 9v9h9\"/>",
 "branding": "<path d=\"M12 4l6.5 7L15 18H9l-3.5-7z\"/><path d=\"M12 4v8\"/><circle cx=\"12\" cy=\"13.5\" r=\"1.5\"/><path d=\"M8.5 21h7\"/>",
 "web": "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 9h18\"/><path d=\"M10 12.5l-2.5 2.5 2.5 2.5M14 12.5l2.5 2.5-2.5 2.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M6 6.5h1M8.5 6.5h1\"/>",
 "print-signage": "<path d=\"M4 3v18M2 21h5M4 5h16\"/><path d=\"M8 5v3M16 5v3\"/><rect x=\"6\" y=\"8\" width=\"12\" height=\"8\" rx=\"2\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M9 12h6\"/>",
 "check": "<path d=\"M4 12.5l5.5 5.5L20 6.5\"/>",
 "arrow-right": "<path d=\"M4 12h15M13 5l7 7-7 7\"/>"
};
window.MC_ICON_LABELS = {
 "photography": "Photography",
 "video": "Videography and post",
 "drone": "Drone and aerial",
 "tour-3d": "3D tours",
 "floorplan": "Floorplans",
 "headshots": "Headshots",
 "strategy": "Marketing strategy",
 "social": "Social management",
 "paid-ads": "Paid advertising",
 "email-sms": "Email and SMS",
 "crm": "CRM and automation",
 "branding": "Branding and design",
 "web": "Web",
 "print-signage": "Print and signage",
 "check": "Done",
 "arrow-right": "Next"
};
post.js347 lines, 23.1 KB
/* Marathon feed post engine. Builds one post from posts.json (through posts.js on file://) plus URL
   params, then enforces the copy limits so overlong copy cannot break the layout.
   LIMITS, COUNTS, and DROP are the only place a limit is written. usage.html reads them from here.

   Order of enforcement, per field:
   1. Hard character cap. Cut at a clause or word, never mid word.
   2. Auto fit. Step the font size down from max to min until the copy fits in its line budget.
   3. Width floor. A wrapping field is also measured for width, so one long unbroken word cannot run past
      the margin. If a word is still wider than the box at min, the size keeps stepping down to the field's
      floor (FLOOR, a share of min). If it is still too wide at the floor, the word is force broken with a
      hyphen at the box edge.
   4. Clamp. If it still does not fit, cut whole words until it does.
   Figures (stat, fact numbers) are never rounded, shortened, or cut. A figure is shown exactly as typed, or it is
   refused: the slot shows a dashed "figure refused" plate and the check panel says why. Only a trailing unit word
   may be dropped, as in 12,400 sq ft to 12,400, because the digits stay exactly as typed.
   Then per post: if the copy block is taller than its zone, drop or shorten fields in the DROP order. */
(function () {
  'use strict';

  /* chars: hard cap. lines: most lines allowed. max, min: font size range in px. lh: line height.
     fit 'lines' wraps, fit 'width' is one line that must fit its box. ellipsis: end a cut with an ellipsis. */
  var LIMITS = {
    eyebrow:    { chars: 32, lines: 1, max: 24, min: 20, lh: 1.2, fit: 'lines', ellipsis: false, note: 'Upper case label. Default per template.' },
    headline:   { chars: 64, lines: 3, max: 80, min: 60, lh: 1.08, fit: 'lines', ellipsis: true, note: 'Sentence case, no full stop.' },
    sub:        { chars: 120, lines: 3, max: 30, min: 26, lh: 1.4, fit: 'lines', ellipsis: true, note: 'One or two plain sentences.' },
    credit:     { chars: 52, lines: 1, max: 24, min: 20, lh: 1.3, fit: 'lines', ellipsis: false, note: 'Who it was shot for, or where.' },
    factValue:  { chars: 11, lines: 1, max: 52, min: 36, lh: 1.05, fit: 'width', number: true, note: 'Number plus a short unit. 1.9, 310 ft, $289K.' },
    factLabel:  { chars: 22, lines: 2, max: 18, min: 16, lh: 1.25, fit: 'lines', ellipsis: false, note: 'What the number is. Acres, Sq ft, Clear height.' },
    stat:       { chars: 11, lines: 1, max: 200, min: 120, lh: 0.9, fit: 'width', number: true, note: 'The approved figure, as typed. Never rounded.' },
    stat_label: { chars: 90, lines: 3, max: 36, min: 28, floor: 28, lh: 1.2, fit: 'lines', ellipsis: true, note: 'What moved, and over what time.' },
    item:       { chars: 56, lines: 2, max: 28, min: 24, lh: 1.3, fit: 'lines', ellipsis: true, note: 'One hiring detail per line.' },
    cta:        { chars: 40, lines: 2, max: 24, min: 20, floor: 20, lh: 1.2, fit: 'lines', ellipsis: false, note: 'A verb first. Wraps to two lines.' }
  };
  /* Template specific overrides of the ranges above. */
  var SIZES = {
    listing:  { headline: { lines: 3, max: 80, min: 60 } },
    bts:      { headline: { lines: 3, max: 72, min: 56 } },
    stat:     {},
    announce: { headline: { lines: 3, max: 68, min: 52 }, sub: { lines: 2, max: 28, min: 24 } },
    hiring:   { headline: { lines: 2, max: 64, min: 50 } }
  };
  /* When the number is too wide to sit beside its label, it stacks and uses this range instead. */
  var STACKED_STAT = { square: { max: 150, min: 96 }, portrait: { max: 180, min: 110 } };
  /* Width floor for wrapping fields: share of the field's min size it may drop to, only when one word is too wide. */
  var FLOOR = 0.72;
  var COUNTS = { facts: 3, services: 3, items: 3 };
  /* Share of the canvas height the copy may take on full bleed posts. The photo keeps the rest. */
  var BUDGET = { square: 0.54, portrait: 0.48 };
  /* What gives way, in order, when the copy block is still too tall after every field is fitted. */
  var DROP = {
    listing:  [['lines', 'headline', 2], ['hide', 'credit']],
    bts:      [['lines', 'sub', 2], ['hide', 'sub'], ['lines', 'headline', 2]],
    stat:     [['lines', 'stat_label', 2], ['hide', 'credit']],
    announce: [['lines', 'sub', 1], ['hide', 'sub'], ['lines', 'headline', 2]],
    hiring:   [['count', 'items', 2], ['lines', 'headline', 1], ['count', 'items', 1]]
  };
  var DEFAULT_EYEBROW = { listing: 'Just shot', bts: 'Behind the scenes', stat: 'Result', announce: 'Announcement', hiring: 'Now hiring' };
  var KINDS = { residential: 'residential', land: 'land', commercial: 'commercial', industrial: 'industrial' };
  var FULL_BLEED = { listing: true, bts: true };
  var LOGO_WHITE = '../../../tokens/v/best/logos/marathon-logo-white.svg';
  var LOGO_DARK = '../../../tokens/v/best/logos/marathon-logo-dark.svg';
  var SVC_LABEL = { photography: 'Photo', video: 'Video', drone: 'Drone', 'tour-3d': '3D tour', floorplan: 'Floor plan',
    headshots: 'Headshots', strategy: 'Strategy', social: 'Social', 'paid-ads': 'Paid ads', 'email-sms': 'Email and SMS',
    crm: 'CRM', branding: 'Branding', web: 'Web', 'print-signage': 'Print' };
  var STOP = /^(and|or|the|a|an|of|to|for|with|in|on|at|so|by|from|every|single|this|that|your|our|one)$/i;

  window.MC_LIMITS = { FLOOR: FLOOR, STACKED_STAT: STACKED_STAT, LIMITS: LIMITS, SIZES: SIZES, COUNTS: COUNTS, BUDGET: BUDGET, DROP: DROP, DEFAULT_EYEBROW: DEFAULT_EYEBROW, SVC_LABEL: SVC_LABEL };
  if (document.documentElement.hasAttribute('data-limits-only')) return;

  var report = [];
  function note(m) { report.push(m); }
  function spec(tpl, field) {
    var s = {}, k, base = LIMITS[field], o = (SIZES[tpl] || {})[field] || {};
    for (k in base) s[k] = base[k];
    for (k in o) s[k] = o[k];
    return s;
  }
  function q() { var o = {}; new URLSearchParams(location.search).forEach(function (v, k) { o[k] = v; }); return o; }
  function el(tag, cls, text) { var e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }
  function icon(name) {
    var s = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
    s.setAttribute('viewBox', '0 0 24 24'); s.setAttribute('class', 'mc-icon mc-icon--display'); s.setAttribute('aria-hidden', 'true');
    s.innerHTML = (window.MC_ICONS || {})[name] || '';
    return s;
  }
  function clean(t) { return String(t == null ? '' : t).replace(/\s+/g, ' ').trim(); }
  function tidyEnd(words) {
    while (words.length > 1 && STOP.test(words[words.length - 1].replace(/[,.;:]$/, ''))) words.pop();
    return words.join(' ').replace(/[,;:.\s]+$/, '');
  }
  function capChars(t, s, field) {
    if (t.length <= s.chars) return t;
    if (s.number) {
      /* A figure is never rounded or cut. Only a trailing unit word may go, the digits stay as typed. */
      var m = /^(\S*\d\S*)\s+([^\d\s].*)$/.exec(t);
      if (m && m[1].length <= s.chars) { note(field + ': "' + t + '" lost its unit "' + m[2] + '", the figure "' + m[1] + '" is exactly as typed. Put the unit in the label'); return m[1]; }
      return null;
    }
    var cut = t.slice(0, s.chars + 1), comma = cut.lastIndexOf(','), sp = cut.lastIndexOf(' '), out;
    if (sp <= 0) {
      /* One word longer than the cap. Never cut it silently, end it with an ellipsis so the cut shows. */
      out = t.slice(0, s.chars - 1) + '…';
      note(field + ': one word over ' + s.chars + ' characters, cut to "' + out + '". Use a shorter word');
      return out;
    }
    out = (!s.ellipsis && comma > s.chars * 0.45) ? cut.slice(0, comma) : tidyEnd(cut.slice(0, sp).split(' '));
    if (s.ellipsis) out += '…';
    note(field + ': over ' + s.chars + ' characters, cut to "' + out + '"');
    return out;
  }
  function linesOf(e, size, lh) { return Math.round(e.getBoundingClientRect().height / (size * lh)); }
  function overWidth(e) { return e.scrollWidth > e.clientWidth + 1; }
  function fitsNow(e, s, size) { return s.fit === 'width' ? !overWidth(e) : (linesOf(e, size, s.lh) <= s.lines && !overWidth(e)); }
  function floorOf(s) { return Math.max(12, Math.round(s.min * FLOOR / 2) * 2); }
  /* Width of one word in the element's own font, tracking, and case. */
  function wordWidth(e, w) {
    var m = document.createElement('span'), cs = getComputedStyle(e);
    m.textContent = w; m.style.cssText = 'position:absolute;visibility:hidden;white-space:nowrap;left:0;top:0';
    ['fontFamily', 'fontSize', 'fontWeight', 'letterSpacing', 'textTransform', 'fontVariantNumeric'].forEach(function (k) { m.style[k] = cs[k]; });
    document.body.appendChild(m); var r = m.getBoundingClientRect().width; m.remove(); return r;
  }
  function longestWord(e, t) {
    var best = 0; t.split(' ').forEach(function (w) { best = Math.max(best, wordWidth(e, w)); }); return best;
  }
  /* Forced break. Any word wider than the box gets a soft hyphen between every letter, so the browser breaks
     it at the box edge with a visible hyphen, and shows no hyphen where the word does not need to break. */
  function forceBreak(e, t) {
    var box = e.clientWidth;
    return t.split(' ').map(function (w) { return wordWidth(e, w) <= box ? w : w.split('').join('\u00AD'); }).join(' ');
  }

  /* Refusal. A figure that cannot be shown exactly as typed is not shown at all. The slot gets a dashed plate,
     the body gets data-refused, and the check panel says why. Nothing publishes a number nobody approved. */
  function refuse(e, field, raw, why) {
    e.classList.add('refused'); e.style.fontSize = ''; e.textContent = 'Figure refused, see copy check';
    document.body.setAttribute('data-refused', '1');
    note('REFUSED ' + field + ': "' + clean(raw) + '" ' + why + '. The template never rounds or cuts a figure. Type the approved short form yourself, for example $1.25M, and confirm it with the client');
  }

  /* The four step fit for one element. Returns false for a figure that cannot be shown as typed. */
  function fit(e, raw, s, field) {
    var t = capChars(clean(raw), s, field), size;
    e.classList.remove('refused'); e.dataset.field = field;
    if (t === null) { e.textContent = clean(raw); e.dataset.over = 'chars'; return false; }
    e.textContent = t; delete e.dataset.over;
    for (size = s.max; size >= s.min; size -= 2) { e.style.fontSize = size + 'px'; if (fitsNow(e, s, size)) return true; }
    size = s.min; e.style.fontSize = size + 'px';
    if (s.fit === 'width' && s.number) { e.dataset.over = 'width'; return false; }
    if (s.fit === 'lines' && longestWord(e, t) > e.clientWidth) {
      var floor = s.floor || floorOf(s);
      while (size > floor && longestWord(e, t) > e.clientWidth) { size -= 2; e.style.fontSize = size + 'px'; }
      note(field + ': a word is wider than the box at ' + s.min + 'px, shrunk to ' + size + 'px (floor ' + floor + 'px)');
      if (longestWord(e, t) > e.clientWidth) {
        t = forceBreak(e, t); e.textContent = t;
        note(field + ': a word is still too wide at the ' + floor + 'px floor, force broken with a hyphen at the margin, "' + t.replace(/\u00AD/g, '') + '". Use a shorter word');
      }
      if (fitsNow(e, s, size)) return true;
    }
    var words = t.replace(/…$/, '').split(' ');
    while (words.length > 1 && !fitsNow(e, s, size)) {
      words.pop();
      var w = words.slice();
      e.textContent = tidyEnd(w) + (s.ellipsis ? '…' : '');
    }
    note(field + ': too long for ' + s.lines + ' line' + (s.lines > 1 ? 's' : '') + ' at ' + s.min + 'px, clamped to "' + e.textContent + '"');
    return false;
  }

  function load() {
    var data = window.MC_POSTS || { photos: {}, posts: {} };
    var p = q(), id = p.id || 'listing-land', base = data.posts[id];
    if (!base) { note('No post called "' + id + '", showed listing-land'); id = 'listing-land'; base = data.posts[id]; }
    var d = JSON.parse(JSON.stringify(base));
    ['tpl', 'kind', 'eyebrow', 'headline', 'sub', 'credit', 'stat', 'stat_label', 'cta'].forEach(function (k) { if (p[k] != null) d[k] = p[k]; });
    if (p.photo != null) {
      if (data.photos[p.photo]) d.photo = p.photo;
      else note('Photo "' + p.photo + '" is not in the Marathon photo library, kept ' + d.photo);
    }
    var i, f;
    for (i = 1; i <= 5; i++) {
      if (p['f' + i]) { d.facts = d.facts || []; f = p['f' + i].split('|'); d.facts[i - 1] = { value: f[0], label: f[1] || '' }; }
      if (p['i' + i]) { d.items = d.items || []; d.items[i - 1] = p['i' + i]; }
    }
    if (p.services) d.services = p.services.split(',');
    d.size = p.size === 'portrait' ? 'portrait' : 'square';
    d.focus = p.focus ? p.focus.split(',').map(function (n) { return parseFloat(n) + '%'; }).join(' ') : null;
    d.check = p.check === '1'; d.guides = p.guides === '1';
    d.photoMeta = data.photos[d.photo] || {};
    if (!DEFAULT_EYEBROW[d.tpl]) { note('Unknown template "' + d.tpl + '", used listing'); d.tpl = 'listing'; }
    /* A drawn boundary is the client's deliverable. Scrim, type, and red never cross it, so a boundary
       photo always gets the split layout: photo untouched on top, copy on solid navy below. */
    d.split = !!(FULL_BLEED[d.tpl] && (d.photoMeta.boundary || d.photoMeta.people));
    if (d.split) note('layout: ' + d.photo + (d.photoMeta.boundary ? ' carries a drawn boundary' : ' shows people') + ', switched to the split layout so nothing covers it');
    return { d: d, id: id };
  }

  function build(d) {
    var post = document.getElementById('post');
    post.className = 'post tpl-' + d.tpl + (d.size === 'portrait' ? ' portrait' : '');
    var img = el('img', 'photo');
    img.src = 'photos/' + d.photo + '.jpg'; img.alt = d.photoMeta.alt || '';
    img.style.objectPosition = d.focus || d.photoMeta.focus || '50% 50%';
    var nodes = {};

    var eyebrowText = d.eyebrow || (DEFAULT_EYEBROW[d.tpl] + (d.tpl === 'listing' && KINDS[d.kind] ? ', ' + KINDS[d.kind] : ''));
    nodes.eyebrow = el('p', 'eyebrow'); nodes.eyebrowText = eyebrowText;
    var bar = el('i', 'bar');

    if (FULL_BLEED[d.tpl]) {
      if (d.split) { var sm = el('div', 'media'); sm.appendChild(img); post.appendChild(sm); post.classList.add('split'); }
      else post.appendChild(img);
      var tab = el('div', 'tab'), logo = el('img'); logo.src = LOGO_WHITE; logo.alt = 'Marathon Creative'; tab.appendChild(logo); post.appendChild(tab);
      var block = el('div', d.split ? 'splitpanel' : 'scrim'); nodes.block = block;
      block.appendChild(nodes.eyebrow); block.appendChild(bar);
      nodes.headline = el('h1', 'headline'); block.appendChild(nodes.headline);
      if (d.tpl === 'listing') {
        nodes.credit = el('p', 'credit'); block.appendChild(nodes.credit);
        var facts = (d.facts || []).filter(function (x) { return x && clean(x.value); });
        if (facts.length > COUNTS.facts) { note('facts: ' + facts.length + ' given, only the first ' + COUNTS.facts + ' fit'); facts = facts.slice(0, COUNTS.facts); }
        if (facts.length) {
          var row = el('div', 'facts'); row.style.setProperty('--n', facts.length); nodes.facts = [];
          facts.forEach(function (x) { var c = el('div', 'fact'), b = el('b'), s = el('span'); c.appendChild(b); c.appendChild(s); row.appendChild(c); nodes.facts.push([b, s, x]); });
          block.appendChild(row);
        }
      } else {
        nodes.sub = el('p', 'sub'); block.appendChild(nodes.sub);
        var svcs = (d.services || []).filter(function (s) { return SVC_LABEL[s]; });
        if ((d.services || []).length !== svcs.length) note('services: unknown names dropped, use the names in usage.html');
        if (svcs.length > COUNTS.services) { note('services: ' + svcs.length + ' given, only the first ' + COUNTS.services + ' fit'); svcs = svcs.slice(0, COUNTS.services); }
        if (svcs.length) {
          var sr = el('div', 'services');
          svcs.forEach(function (s) { var c = el('span', 'svc'); c.appendChild(icon(s)); c.appendChild(document.createTextNode(SVC_LABEL[s])); sr.appendChild(c); });
          block.appendChild(sr);
        }
      }
      post.appendChild(block);
    } else {
      var media = el('div', 'media'); media.appendChild(img); post.appendChild(media);
      var panel = el('div', 'panel'), body = el('div', 'body'), foot = el('div', 'foot');
      nodes.body = body; nodes.block = body;
      body.appendChild(nodes.eyebrow); body.appendChild(bar);
      if (d.tpl === 'stat') {
        var sr2 = el('div', 'statrow'); nodes.statrow = sr2;
        nodes.stat = el('p', 'stat'); nodes.stat_label = el('p', 'stat_label');
        sr2.appendChild(nodes.stat); sr2.appendChild(nodes.stat_label); body.appendChild(sr2);
        nodes.credit = el('p', 'credit'); foot.appendChild(nodes.credit);
      } else {
        nodes.headline = el('h1', 'headline'); body.appendChild(nodes.headline);
        if (d.tpl === 'announce') { nodes.sub = el('p', 'sub'); body.appendChild(nodes.sub); }
        if (d.tpl === 'hiring') {
          var items = (d.items || []).map(clean).filter(Boolean);
          if (items.length > COUNTS.items) { note('items: ' + items.length + ' given, only the first ' + COUNTS.items + ' fit'); items = items.slice(0, COUNTS.items); }
          var ul = el('ul', 'items'); nodes.items = [];
          items.forEach(function (t) { var li = el('li'), sp = el('span'); li.appendChild(icon('check')); li.appendChild(sp); ul.appendChild(li); nodes.items.push([li, sp, t]); });
          body.appendChild(ul);
        }
        nodes.cta = el('span', 'cta'); foot.appendChild(nodes.cta);
      }
      var flogo = el('img'); flogo.src = d.tpl === 'announce' ? LOGO_DARK : LOGO_WHITE; flogo.alt = 'Marathon Creative'; foot.appendChild(flogo);
      panel.appendChild(body); panel.appendChild(foot); post.appendChild(panel);
    }
    if (d.guides) post.appendChild(el('div', 'guides'));
    return nodes;
  }

  function fitAll(d, n, lines) {
    var t = d.tpl, s;
    var es = spec(t, 'eyebrow'), fallback = DEFAULT_EYEBROW[t] + (t === 'listing' && KINDS[d.kind] ? ', ' + KINDS[d.kind] : '');
    if (n.eyebrowText !== fallback && clean(n.eyebrowText).length > es.chars) {
      note('eyebrow: "' + n.eyebrowText + '" is over ' + es.chars + ' characters, used the template label "' + fallback + '"');
      n.eyebrowText = fallback;
    }
    fit(n.eyebrow, n.eyebrowText, es, 'eyebrow');
    if (n.headline) { s = spec(t, 'headline'); if (lines.headline) s.lines = lines.headline; fit(n.headline, d.headline, s, 'headline'); }
    if (n.sub && !n.sub.hidden) { s = spec(t, 'sub'); if (lines.sub) s.lines = lines.sub; fit(n.sub, d.sub, s, 'sub'); }
    if (n.credit && !n.credit.hidden) fit(n.credit, d.credit, spec(t, 'credit'), 'credit');
    (n.facts || []).forEach(function (f) { fit(f[0], f[2].value, spec(t, 'factValue'), 'factValue'); fit(f[1], f[2].label, spec(t, 'factLabel'), 'factLabel'); });
    (n.items || []).forEach(function (it) { if (!it[0].hidden) fit(it[1], it[2], spec(t, 'item'), 'item'); });
    if (n.cta) {
      /* The button label wraps to two lines and uses the same long word fallback as the headline:
         shrink, then a hyphen at the button edge. Nothing is clipped by the button. */
      var ctaText = d.cta || 'Book at marathoncreative.co';
      n.cta.textContent = ''; var label = el('span', 'cta-label'); n.cta.appendChild(label); n.cta.appendChild(icon('arrow-right'));
      fit(label, ctaText, spec(t, 'cta'), 'cta');
    }
    (n.facts || []).forEach(function (f) {
      if (f[0].dataset.over) refuse(f[0], 'factValue', f[2].value, f[0].dataset.over === 'chars' ? 'is over ' + spec(t, 'factValue').chars + ' characters' : 'is too wide for its cell at the smallest size');
    });
    if (n.stat) {
      s = spec(t, 'stat');
      n.stat.style.maxWidth = n.statrow.classList.contains('stacked') ? '100%' : '58%';
      n.stat.style.overflow = 'hidden';
      if (n.statrow.classList.contains('stacked')) { s.max = STACKED_STAT[d.size].max; s.min = STACKED_STAT[d.size].min; }
      var fitted = fit(n.stat, d.stat, s, 'stat');
      if (!fitted || n.stat.getBoundingClientRect().width > 0.58 * n.statrow.getBoundingClientRect().width - 1) {
        if (!n.statrow.classList.contains('stacked')) {
          n.statrow.classList.add('stacked'); note('stat: too wide to sit beside its label, label moved under the number');
        }
        n.stat.style.maxWidth = '100%'; s.max = STACKED_STAT[d.size].max; s.min = STACKED_STAT[d.size].min;
        if (!fit(n.stat, d.stat, s, 'stat')) {
          refuse(n.stat, 'stat', d.stat, n.stat.dataset.over === 'chars' ? 'is over ' + s.chars + ' characters' : 'is too wide to print at ' + s.min + 'px, the smallest stat size');
          if (!n.statrow.classList.contains('stacked')) n.statrow.classList.add('stacked');
        }
      }
      s = spec(t, 'stat_label'); if (lines.stat_label) s.lines = lines.stat_label; fit(n.stat_label, d.stat_label, s, 'stat_label');
    }
  }

  function tooTall(d, n) {
    if (d.split) return n.block.scrollHeight > n.block.clientHeight + 1;
    if (FULL_BLEED[d.tpl]) {
      var fade = parseFloat(getComputedStyle(n.block).paddingTop);
      var copyH = n.block.getBoundingClientRect().height - fade;
      return copyH > BUDGET[d.size] * document.getElementById('post').getBoundingClientRect().height;
    }
    return n.body.scrollHeight > n.body.clientHeight + 1;
  }

  function run() {
    var L = load(), d = L.d, n = build(d), lines = {}, steps = DROP[d.tpl] || [], i = 0;
    fitAll(d, n, lines);
    while (tooTall(d, n) && i < steps.length) {
      var st = steps[i++];
      if (st[0] === 'lines') { lines[st[1]] = st[2]; note('zone full: ' + st[1] + ' limited to ' + st[2] + ' line' + (st[2] > 1 ? 's' : '')); }
      if (st[0] === 'hide' && n[st[1]]) { n[st[1]].hidden = true; note('zone full: ' + st[1] + ' dropped'); }

      if (st[0] === 'count' && n[st[1]]) { n[st[1]].forEach(function (it, k) { if (k >= st[2]) it[0].hidden = true; }); note('zone full: ' + st[1] + ' limited to ' + st[2]); }
      fitAll(d, n, lines);
    }
    if (tooTall(d, n)) note('STILL TOO TALL after every step. Shorten the copy.');
    report = report.filter(function (r, k) { return report.indexOf(r) === k; });
    var rep = document.getElementById('report');
    if (d.check) {
      rep.hidden = false;
      rep.appendChild(el('h2', null, 'Copy check, ' + L.id + ', ' + d.size));
      rep.appendChild(el('p', null, report.length ? report.length + ' change' + (report.length > 1 ? 's' : '') + ' made by the template' : 'Fits as written'));
      if (report.length) { var ol = el('ol'); report.forEach(function (r) { ol.appendChild(el('li', null, r)); }); rep.appendChild(ol); }
      else rep.appendChild(el('span', 'ok', 'Nothing was cut, shrunk past max, or dropped.'));
    }
    window.MC_REPORT = report;
    document.body.setAttribute('data-ready', '1');
  }

  var go = function () { try { run(); } catch (e) { document.body.setAttribute('data-error', String(e)); throw e; } };
  if (document.fonts && document.fonts.load) document.fonts.load('800 80px Montserrat').then(go, go); else go();
})();
posts.js289 lines, 9.2 KB
/* GENERATED by build_posts.py from posts.json. Do not edit by hand. */
window.MC_POSTS = {
 "_readme": "Fill file for post.html. Add a post under posts, run python3 build_posts.py, then open post.html?id=<key>&size=square or size=portrait. Photos must be a key from photos. Every figure in a _confirm field waits on Jacob before it posts.",
 "photos": {
  "mc_fullres_10": {
   "alt": "Wooded lot beside a golf course, red boundary drawn on the lot",
   "orient": "landscape",
   "boundary": true,
   "focus": "50% 50%"
  },
  "mc_fullres_11": {
   "alt": "Wooded lot among estate homes, red boundary drawn on the lot",
   "orient": "landscape",
   "boundary": true,
   "focus": "50% 50%"
  },
  "mc_fullres_12": {
   "alt": "Overhead drone frame of a wooded lot on a golf course, red boundary drawn on the lot",
   "orient": "landscape",
   "boundary": true,
   "focus": "42% 50%"
  },
  "mc_fullres_13": {
   "alt": "Overhead drone frame of a wooded lot, red boundary drawn on the lot",
   "orient": "landscape",
   "boundary": true,
   "focus": "45% 50%"
  },
  "mc_fullres_14": {
   "alt": "Golf course aerial with a small lot outlined in red",
   "orient": "landscape",
   "boundary": true,
   "focus": "40% 50%"
  },
  "mc_fullres_15": {
   "alt": "Golf course lake aerial with a lot outlined in red",
   "orient": "landscape",
   "boundary": true,
   "focus": "50% 50%"
  },
  "mc_retouched_01": {
   "alt": "Cangelosi team standing in front of a marble wall",
   "orient": "landscape",
   "people": true,
   "focus": "50% 50%"
  },
  "mc_retouched_02": {
   "alt": "Cangelosi stone monument sign",
   "orient": "landscape",
   "focus": "50% 50%"
  },
  "mc_retouched_03": {
   "alt": "Cangelosi showroom with sample racks and slab displays",
   "orient": "landscape",
   "focus": "55% 50%"
  },
  "mc_retouched_04": {
   "alt": "White marble wall with the Cangelosi name",
   "orient": "landscape",
   "focus": "50% 50%"
  },
  "mc_retouched_05": {
   "alt": "Cangelosi showroom design tables and stone sample racks",
   "orient": "landscape",
   "focus": "50% 50%"
  },
  "mc_retouched_06": {
   "alt": "Close up of lit marble slab edges",
   "orient": "landscape",
   "focus": "50% 50%"
  },
  "mc_retouched_07": {
   "alt": "Framed quarry photograph in the Cangelosi showroom",
   "orient": "portrait",
   "focus": "50% 45%"
  },
  "mc_retouched_08": {
   "alt": "Tall rack of stone samples on a dark display wall",
   "orient": "portrait",
   "focus": "50% 40%"
  },
  "mc_retouched_09": {
   "alt": "Quartz sample tower with pink and white tabs",
   "orient": "portrait",
   "focus": "50% 40%"
  },
  "mc_rosehill_16": {
   "alt": "Rosehill Reserve aerial over rooftops, ponds, and green space",
   "orient": "landscape",
   "focus": "50% 50%"
  },
  "mc_rosehill_17": {
   "alt": "Rosehill Reserve entry monument with retail behind it",
   "orient": "landscape",
   "focus": "50% 50%"
  },
  "mc_rosehill_18": {
   "alt": "Rosehill Reserve aerial looking down a residential street",
   "orient": "portrait",
   "focus": "50% 55%"
  }
 },
 "posts": {
  "listing-land": {
   "tpl": "listing",
   "kind": "land",
   "photo": "mc_fullres_12",
   "eyebrow": "Just shot, land",
   "headline": "Every acre outlined before the buyer asks",
   "credit": "Drone and photo for a Greater Houston lot",
   "facts": [
    {
     "value": "1.9",
     "label": "Acres"
    },
    {
     "value": "310 ft",
     "label": "Fairway frontage"
    },
    {
     "value": "City",
     "label": "Water and sewer"
    }
   ],
   "_confirm": "Acreage, frontage, and utilities are working values. Pull the real figures from the listing agent before posting."
  },
  "listing-commercial": {
   "tpl": "listing",
   "kind": "commercial",
   "photo": "mc_retouched_05",
   "eyebrow": "Just shot, commercial",
   "headline": "A stone showroom, shot so the slabs sell",
   "credit": "Photo and video for Cangelosi, Houston",
   "facts": [
    {
     "value": "64",
     "label": "Final stills"
    },
    {
     "value": "2",
     "label": "Shoot days"
    },
    {
     "value": "4K",
     "label": "Walkthrough film"
    }
   ],
   "_confirm": "Still count and shoot days are working values. Confirm against the Cangelosi delivery."
  },
  "listing-residential": {
   "tpl": "listing",
   "kind": "residential",
   "photo": "mc_rosehill_18",
   "eyebrow": "Just shot, residential",
   "headline": "Rosehill Reserve, shot from 400 ft",
   "credit": "Drone, photo, and video for Rosehill Reserve",
   "facts": [
    {
     "value": "$289K",
     "label": "Homes from"
    },
    {
     "value": "1,850",
     "label": "Sq ft and up"
    },
    {
     "value": "12 ac",
     "label": "Parks and ponds"
    }
   ],
   "_confirm": "Starting price, square feet, park acreage, and the 400 ft altitude are working values. Confirm with Rosehill Reserve before posting."
  },
  "bts": {
   "tpl": "bts",
   "photo": "mc_retouched_03",
   "eyebrow": "Behind the scenes",
   "headline": "Lighting 40 ft of marble without one hot spot",
   "sub": "Two days on site at Cangelosi in Houston. Stills, video, and drone from one in-house crew.",
   "services": [
    "photography",
    "video",
    "drone"
   ],
   "_confirm": "The 40 ft wall length is a working value."
  },
  "stat": {
   "tpl": "stat",
   "photo": "mc_rosehill_17",
   "eyebrow": "Result",
   "stat": "38%",
   "stat_label": "more tour requests in 90 days after the new aerial set went live",
   "credit": "Rosehill Reserve, drone, video, and paid social",
   "_confirm": "38% and 90 days are working values. Pull the real figure from the Rosehill Reserve report before posting."
  },
  "announce": {
   "tpl": "announce",
   "photo": "mc_rosehill_16",
   "eyebrow": "Now booking",
   "headline": "Zillow Showcase shoots, on site within 48 hours",
   "sub": "Photo, 3D tour, and floor plan in one visit. Delivered the next business day.",
   "cta": "Book at marathoncreative.co",
   "_confirm": "48 hour booking window and next day delivery are working values."
  },
  "hiring": {
   "tpl": "hiring",
   "photo": "mc_retouched_08",
   "eyebrow": "Now hiring",
   "headline": "Video editor, DaVinci Resolve",
   "items": [
    "Full time, Greater Houston, on set two days a week",
    "Cut listing films, reels, and client spots",
    "Own the edit from ingest to final delivery"
   ],
   "cta": "Apply at marathoncreative.co/careers",
   "_confirm": "Careers URL and on set schedule are working values."
  },
  "stress-listing": {
   "tpl": "listing",
   "kind": "commercial",
   "photo": "mc_retouched_04",
   "eyebrow": "Just shot and just listed this week, commercial",
   "headline": "A full stone showroom shot top to bottom so every single slab, sample, and display wall sells itself to the buyer",
   "credit": "Photo, drone, and video for Cangelosi Marble and Granite, Houston, Texas",
   "facts": [
    {
     "value": "12,400 sq ft",
     "label": "Showroom floor area under roof"
    },
    {
     "value": "64 stills",
     "label": "Final retouched stills"
    },
    {
     "value": "2",
     "label": "Shoot days"
    },
    {
     "value": "4K",
     "label": "Film"
    }
   ]
  },
  "stress-bts": {
   "tpl": "bts",
   "photo": "mc_retouched_04",
   "eyebrow": "Behind the scenes on a two day showroom shoot",
   "headline": "How we lit 40 ft of white marble without a single hot spot, a single reflection, or a single retake on day two",
   "sub": "Two full days on site at Cangelosi in Houston with one in-house crew. Stills, video, drone, and a 3D tour, edited in house in DaVinci and delivered by Friday at 5pm with every file named.",
   "services": [
    "photography",
    "video",
    "drone",
    "tour-3d",
    "social"
   ]
  },
  "stress-stat": {
   "tpl": "stat",
   "photo": "mc_retouched_04",
   "eyebrow": "Result after one full quarter of paid social",
   "stat": "$147,800",
   "stat_label": "in signed contracts traced to the new aerial set, the paid social campaign, and the PaceCRM follow up sequence in 90 days",
   "credit": "Rosehill Reserve, drone, video, paid social, and CRM automation"
  },
  "stress-announce": {
   "tpl": "announce",
   "photo": "mc_retouched_04",
   "eyebrow": "Now booking for every Zillow Showcase listing",
   "headline": "Zillow Showcase shoots are now on site within 48 hours anywhere in Greater Houston, any day of the week",
   "sub": "Photo, 3D tour, interactive floor plan, and drone in one visit, with everything delivered the next business day before noon and a PaceCRM follow up already set up for you.",
   "cta": "Book your Zillow Showcase shoot at marathoncreative.co today"
  },
  "stress-hiring": {
   "tpl": "hiring",
   "photo": "mc_retouched_04",
   "eyebrow": "Now hiring for the in-house production team",
   "headline": "Senior video editor and colorist, DaVinci Resolve Studio, full time",
   "items": [
    "Full time in Greater Houston, on set two days a week with the photo and drone crew",
    "Cut listing films, reels, short form ads, and client brand spots",
    "Own the edit from ingest to final delivery with no handoffs",
    "Color grade in DaVinci",
    "Health plan"
   ],
   "cta": "Apply today at marathoncreative.co/careers/video-editor"
  }
 }
};
posts.json118 lines, 8.8 KB
{
  "_readme": "Fill file for post.html. Add a post under posts, run python3 build_posts.py, then open post.html?id=<key>&size=square or size=portrait. Photos must be a key from photos. Every figure in a _confirm field waits on Jacob before it posts.",
  "photos": {
    "mc_fullres_10": { "alt": "Wooded lot beside a golf course, red boundary drawn on the lot", "orient": "landscape", "boundary": true, "focus": "50% 50%" },
    "mc_fullres_11": { "alt": "Wooded lot among estate homes, red boundary drawn on the lot", "orient": "landscape", "boundary": true, "focus": "50% 50%" },
    "mc_fullres_12": { "alt": "Overhead drone frame of a wooded lot on a golf course, red boundary drawn on the lot", "orient": "landscape", "boundary": true, "focus": "42% 50%" },
    "mc_fullres_13": { "alt": "Overhead drone frame of a wooded lot, red boundary drawn on the lot", "orient": "landscape", "boundary": true, "focus": "45% 50%" },
    "mc_fullres_14": { "alt": "Golf course aerial with a small lot outlined in red", "orient": "landscape", "boundary": true, "focus": "40% 50%" },
    "mc_fullres_15": { "alt": "Golf course lake aerial with a lot outlined in red", "orient": "landscape", "boundary": true, "focus": "50% 50%" },
    "mc_retouched_01": { "alt": "Cangelosi team standing in front of a marble wall", "orient": "landscape", "people": true, "focus": "50% 50%" },
    "mc_retouched_02": { "alt": "Cangelosi stone monument sign", "orient": "landscape", "focus": "50% 50%" },
    "mc_retouched_03": { "alt": "Cangelosi showroom with sample racks and slab displays", "orient": "landscape", "focus": "55% 50%" },
    "mc_retouched_04": { "alt": "White marble wall with the Cangelosi name", "orient": "landscape", "focus": "50% 50%" },
    "mc_retouched_05": { "alt": "Cangelosi showroom design tables and stone sample racks", "orient": "landscape", "focus": "50% 50%" },
    "mc_retouched_06": { "alt": "Close up of lit marble slab edges", "orient": "landscape", "focus": "50% 50%" },
    "mc_retouched_07": { "alt": "Framed quarry photograph in the Cangelosi showroom", "orient": "portrait", "focus": "50% 45%" },
    "mc_retouched_08": { "alt": "Tall rack of stone samples on a dark display wall", "orient": "portrait", "focus": "50% 40%" },
    "mc_retouched_09": { "alt": "Quartz sample tower with pink and white tabs", "orient": "portrait", "focus": "50% 40%" },
    "mc_rosehill_16": { "alt": "Rosehill Reserve aerial over rooftops, ponds, and green space", "orient": "landscape", "focus": "50% 50%" },
    "mc_rosehill_17": { "alt": "Rosehill Reserve entry monument with retail behind it", "orient": "landscape", "focus": "50% 50%" },
    "mc_rosehill_18": { "alt": "Rosehill Reserve aerial looking down a residential street", "orient": "portrait", "focus": "50% 55%" }
  },
  "posts": {
    "listing-land": {
      "tpl": "listing", "kind": "land", "photo": "mc_fullres_12",
      "eyebrow": "Just shot, land",
      "headline": "Every acre outlined before the buyer asks",
      "credit": "Drone and photo for a Greater Houston lot",
      "facts": [ { "value": "1.9", "label": "Acres" }, { "value": "310 ft", "label": "Fairway frontage" }, { "value": "City", "label": "Water and sewer" } ],
      "_confirm": "Acreage, frontage, and utilities are working values. Pull the real figures from the listing agent before posting."
    },
    "listing-commercial": {
      "tpl": "listing", "kind": "commercial", "photo": "mc_retouched_05",
      "eyebrow": "Just shot, commercial",
      "headline": "A stone showroom, shot so the slabs sell",
      "credit": "Photo and video for Cangelosi, Houston",
      "facts": [ { "value": "64", "label": "Final stills" }, { "value": "2", "label": "Shoot days" }, { "value": "4K", "label": "Walkthrough film" } ],
      "_confirm": "Still count and shoot days are working values. Confirm against the Cangelosi delivery."
    },
    "listing-residential": {
      "tpl": "listing", "kind": "residential", "photo": "mc_rosehill_18",
      "eyebrow": "Just shot, residential",
      "headline": "Rosehill Reserve, shot from 400 ft",
      "credit": "Drone, photo, and video for Rosehill Reserve",
      "facts": [ { "value": "$289K", "label": "Homes from" }, { "value": "1,850", "label": "Sq ft and up" }, { "value": "12 ac", "label": "Parks and ponds" } ],
      "_confirm": "Starting price, square feet, park acreage, and the 400 ft altitude are working values. Confirm with Rosehill Reserve before posting."
    },
    "bts": {
      "tpl": "bts", "photo": "mc_retouched_03",
      "eyebrow": "Behind the scenes",
      "headline": "Lighting 40 ft of marble without one hot spot",
      "sub": "Two days on site at Cangelosi in Houston. Stills, video, and drone from one in-house crew.",
      "services": [ "photography", "video", "drone" ],
      "_confirm": "The 40 ft wall length is a working value."
    },
    "stat": {
      "tpl": "stat", "photo": "mc_rosehill_17",
      "eyebrow": "Result",
      "stat": "38%",
      "stat_label": "more tour requests in 90 days after the new aerial set went live",
      "credit": "Rosehill Reserve, drone, video, and paid social",
      "_confirm": "38% and 90 days are working values. Pull the real figure from the Rosehill Reserve report before posting."
    },
    "announce": {
      "tpl": "announce", "photo": "mc_rosehill_16",
      "eyebrow": "Now booking",
      "headline": "Zillow Showcase shoots, on site within 48 hours",
      "sub": "Photo, 3D tour, and floor plan in one visit. Delivered the next business day.",
      "cta": "Book at marathoncreative.co",
      "_confirm": "48 hour booking window and next day delivery are working values."
    },
    "hiring": {
      "tpl": "hiring", "photo": "mc_retouched_08",
      "eyebrow": "Now hiring",
      "headline": "Video editor, DaVinci Resolve",
      "items": [ "Full time, Greater Houston, on set two days a week", "Cut listing films, reels, and client spots", "Own the edit from ingest to final delivery" ],
      "cta": "Apply at marathoncreative.co/careers",
      "_confirm": "Careers URL and on set schedule are working values."
    },

    "stress-listing": {
      "tpl": "listing", "kind": "commercial", "photo": "mc_retouched_04",
      "eyebrow": "Just shot and just listed this week, commercial",
      "headline": "A full stone showroom shot top to bottom so every single slab, sample, and display wall sells itself to the buyer",
      "credit": "Photo, drone, and video for Cangelosi Marble and Granite, Houston, Texas",
      "facts": [ { "value": "12,400 sq ft", "label": "Showroom floor area under roof" }, { "value": "64 stills", "label": "Final retouched stills" }, { "value": "2", "label": "Shoot days" }, { "value": "4K", "label": "Film" } ]
    },
    "stress-bts": {
      "tpl": "bts", "photo": "mc_retouched_04",
      "eyebrow": "Behind the scenes on a two day showroom shoot",
      "headline": "How we lit 40 ft of white marble without a single hot spot, a single reflection, or a single retake on day two",
      "sub": "Two full days on site at Cangelosi in Houston with one in-house crew. Stills, video, drone, and a 3D tour, edited in house in DaVinci and delivered by Friday at 5pm with every file named.",
      "services": [ "photography", "video", "drone", "tour-3d", "social" ]
    },
    "stress-stat": {
      "tpl": "stat", "photo": "mc_retouched_04",
      "eyebrow": "Result after one full quarter of paid social",
      "stat": "$147,800",
      "stat_label": "in signed contracts traced to the new aerial set, the paid social campaign, and the PaceCRM follow up sequence in 90 days",
      "credit": "Rosehill Reserve, drone, video, paid social, and CRM automation"
    },
    "stress-announce": {
      "tpl": "announce", "photo": "mc_retouched_04",
      "eyebrow": "Now booking for every Zillow Showcase listing",
      "headline": "Zillow Showcase shoots are now on site within 48 hours anywhere in Greater Houston, any day of the week",
      "sub": "Photo, 3D tour, interactive floor plan, and drone in one visit, with everything delivered the next business day before noon and a PaceCRM follow up already set up for you.",
      "cta": "Book your Zillow Showcase shoot at marathoncreative.co today"
    },
    "stress-hiring": {
      "tpl": "hiring", "photo": "mc_retouched_04",
      "eyebrow": "Now hiring for the in-house production team",
      "headline": "Senior video editor and colorist, DaVinci Resolve Studio, full time",
      "items": [ "Full time in Greater Houston, on set two days a week with the photo and drone crew", "Cut listing films, reels, short form ads, and client brand spots", "Own the edit from ingest to final delivery with no handoffs", "Color grade in DaVinci", "Health plan" ],
      "cta": "Apply today at marathoncreative.co/careers/video-editor"
    }
  }
}
render_all.mjs65 lines, 4.9 KB
// Renders every post, size, photo test, and long copy test into renders/ with one Chrome session.
// Run from the repo root: node build/social-feed/v/r04/render_all.mjs
// Drives the installed Chrome in a throwaway profile, never the user's running Chrome.
import { chromium } from 'playwright-core';
import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import url from 'node:url';
const R = path.dirname(url.fileURLToPath(import.meta.url));
const OUT = path.join(R, 'renders');
const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'mc-chrome-'));
const ctx = await chromium.launchPersistentContext(profile, {
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true, viewport: { width: 1080, height: 1080 },
});
const page = await ctx.newPage();
const reports = {};
async function shot(query, out, w, h) {
  await page.setViewportSize({ width: w, height: h });
  await page.goto('file://' + path.join(R, 'post.html') + '?' + query, { waitUntil: 'load' });
  await page.waitForSelector('body[data-ready="1"]', { timeout: 10000 });
  await page.evaluate(() => Promise.all([...document.images].map(i => i.decode().catch(() => null))));
  const file = path.join(OUT, out);
  fs.mkdirSync(path.dirname(file), { recursive: true });
  if (w === 1080) await page.locator('#post').screenshot({ path: file });
  else await page.screenshot({ path: file });
  reports[out] = await page.evaluate(() => window.MC_REPORT);
}
const SIZES = { square: 1080, portrait: 1350 };
const POSTS = ['listing-land', 'listing-commercial', 'listing-residential', 'bts', 'stat', 'announce', 'hiring'];
const TEST_TPL = ['listing-commercial', 'bts', 'stat', 'announce', 'hiring'];
const TEST_PHOTO = { interior: 'mc_retouched_05', aerial: 'mc_rosehill_16', portrait: 'mc_retouched_08', boundary: 'mc_fullres_12' };
for (const [size, h] of Object.entries(SIZES)) {
  for (const id of POSTS) await shot(`id=${id}&size=${size}`, `posts/${id}-${size}.png`, 1080, h);
  for (const t of TEST_TPL) for (const [k, ph] of Object.entries(TEST_PHOTO))
    await shot(`id=${t}&size=${size}&photo=${ph}`, `photo-test/${t}-${size}-${k}.png`, 1080, h);
  for (const t of ['listing', 'bts', 'stat', 'announce', 'hiring']) {
    for (const [k, ph] of Object.entries({ bright: 'mc_retouched_04', busy: 'mc_rosehill_16', tall: 'mc_retouched_08', boundary: 'mc_fullres_12' }))
      await shot(`id=stress-${t}&size=${size}&photo=${ph}`, `stress/stress-${t}-${size}-${k}.png`, 1080, h);
    await shot(`id=stress-${t}&size=${size}&check=1`, `stress/stress-${t}-${size}-check.png`, 1520, h);
  }
  // Long unbroken word test, run (c) of the functional test, filled through the URL params.
  const LONG = { word: 'Supercalifragilisticexpialidocious Industrial', url: 'marathoncreative.co/careers/senior-videographer-houston' };
  const LW = { 'listing-commercial': 'headline', bts: 'headline', announce: 'headline', hiring: 'headline', stat: 'stat_label' };
  for (const [t, field] of Object.entries(LW)) for (const [lk, txt] of Object.entries(LONG))
    for (const [k, ph] of Object.entries({ interior: 'mc_retouched_05', aerial: 'mc_rosehill_16', portrait: 'mc_retouched_08' }))
      await shot(`id=${t}&size=${size}&photo=${ph}&${field}=${encodeURIComponent(txt)}`, `longword/${t}-${size}-${lk}-${k}.png`, 1080, h);
  await shot(`id=listing-commercial&size=${size}&check=1&headline=${encodeURIComponent(LONG.url)}`, `longword/check-listing-${size}-url.png`, 1520, h);
  // Round 4 gap: stat label and button long word fallback, and figures shown as typed or refused, never rounded.
  const EDGE = {
    'label-beside': 'id=stat&stat_label=' + encodeURIComponent('MountainviewWoodlandsCrossingParkwayNortheast listings up in 90 days'),
    'label-stacked': 'id=stat&stat=' + encodeURIComponent('$1,250,000') + '&stat_label=' + encodeURIComponent('MountainviewWoodlandsCrossingParkwayNortheastHoustonCorridor listings'),
    'stat-asis': 'id=stat&stat=' + encodeURIComponent('$1,250,000'),
    'stat-digits': 'id=stat&stat=1234567890',
    'stat-refused': 'id=stat&stat=' + encodeURIComponent('$1,250,000,000'),
    'fact-refused': 'id=listing-commercial&f1=' + encodeURIComponent('$1,250,000,000|Price'),
    'cta-word': 'id=announce&cta=MOUNTAINVIEWWOODLANDSCROSSINGPARKWAYNE',
    'cta-url': 'id=hiring&cta=' + encodeURIComponent('Apply at marathoncreative.co/careers/editor'),
    'cta-long': 'id=announce&cta=' + encodeURIComponent('Book your Zillow Showcase shoot this week'),
  };
  for (const [k, q] of Object.entries(EDGE)) {
    await shot(`${q}&size=${size}`, `edge/${k}-${size}.png`, 1080, h);
    await shot(`${q}&size=${size}&check=1`, `edge/check-${k}-${size}.png`, 1520, h);
  }
}
fs.writeFileSync(path.join(OUT, 'engine-report.json'), JSON.stringify(reports, null, 1));
await ctx.close(); fs.rmSync(profile, { recursive: true, force: true });
console.log('rendered', Object.keys(reports).length, 'images');
build_icons.py20 lines, 1.3 KB
# Copies the icons this piece uses out of the shared icon set into icons-inline.js.
# Run after the icon set changes: python3 build_icons.py. Never edit icons-inline.js by hand.
# Chrome blocks an external <use> href on file://, so the drawing is inlined instead. Nothing is redrawn.
import json, os, re
here = os.path.dirname(os.path.abspath(__file__))
src = os.path.join(here, '..', '..', '..', 'icons', 'v', 'best')
names = ['photography', 'video', 'drone', 'tour-3d', 'floorplan', 'headshots', 'strategy', 'social',
         'paid-ads', 'email-sms', 'crm', 'branding', 'web', 'print-signage', 'check', 'arrow-right']
out, labels = {}, {}
for n in names:
    svg = open(os.path.join(src, 'svg', 'mc-icon-%s.svg' % n), encoding='utf-8').read().strip()
    out[n] = re.search(r'<svg[^>]*>(.*)</svg>', svg, re.S).group(1)
    m = re.search(r'aria-label="([^"]+)"', svg)
    labels[n] = m.group(1) if m else n
js = ('/* GENERATED by build_icons.py from ../../../icons/v/best/svg. Do not edit by hand. */\n'
      'window.MC_ICONS = ' + json.dumps(out, indent=1) + ';\n'
      'window.MC_ICON_LABELS = ' + json.dumps(labels, indent=1) + ';\n')
open(os.path.join(here, 'icons-inline.js'), 'w', encoding='utf-8').write(js)
print('wrote icons-inline.js with', len(out), 'icons')
build_posts.py10 lines, 625 bytes
# Writes posts.js from posts.json so post.html can read the fill file on file://, where Chrome blocks fetch.
# Edit posts.json, then run: python3 build_posts.py. Never edit posts.js by hand.
import json, os
here = os.path.dirname(os.path.abspath(__file__))
data = json.load(open(os.path.join(here, 'posts.json'), encoding='utf-8'))
open(os.path.join(here, 'posts.js'), 'w', encoding='utf-8').write(
    '/* GENERATED by build_posts.py from posts.json. Do not edit by hand. */\nwindow.MC_POSTS = '
    + json.dumps(data, indent=1, ensure_ascii=False) + ';\n')
print('wrote posts.js with', len(data.get('posts', {})), 'posts')
sheets.py97 lines, 5.9 KB
# Builds the contact sheets in renders/ from the single post renders. Run after render_all.mjs:
#   python3 build/social-feed/v/r04/sheets.py
# Labels are set in Montserrat from the token layer. Sheet colours are read from tokens.json.
import json, os
from PIL import Image, ImageDraw, ImageFont
R = os.path.dirname(os.path.abspath(__file__))
OUT = os.path.join(R, 'renders')
TOK = os.path.join(R, '..', '..', '..', 'tokens', 'v', 'best')
FONT = os.path.join(TOK, 'fonts', 'Montserrat-VariableFont_wght.ttf')

def token_hex(name):
    data = json.load(open(os.path.join(TOK, 'tokens.json')))
    found = []
    def walk(o):
        if isinstance(o, dict):
            for k, v in o.items():
                if k == name and isinstance(v, (str, dict)): found.append(v)
                walk(v)
    walk(data)
    for v in found:
        val = v.get('hex', v.get('value')) if isinstance(v, dict) else v
        if isinstance(val, str) and val.startswith('#'): return val
    raise SystemExit('token not found: ' + name)

NAVY, RED, SLATE, PAPER, WASH = (token_hex(n) for n in ('navy-100', 'red-100', 'slate-500', 'white', 'gray-100'))

def font(size, weight):
    f = ImageFont.truetype(FONT, size)
    try: f.set_variation_by_axes([weight])
    except Exception: pass
    return f

def sheet(cells, cols, out, title, sub, thumb_w=360):
    """cells: list of (path, label). Keeps the 1:1 and 4:5 shapes true."""
    ims = []
    for p, lab in cells:
        im = Image.open(os.path.join(OUT, p)).convert('RGB')
        im = im.resize((thumb_w, round(im.height * thumb_w / im.width)), Image.LANCZOS)
        ims.append((im, lab))
    gap, pad, lab_h, head = 28, 56, 46, 150
    rows = [ims[i:i + cols] for i in range(0, len(ims), cols)]
    row_h = [max(im.height for im, _ in r) + lab_h for r in rows]
    W = pad * 2 + cols * thumb_w + (cols - 1) * gap
    H = head + pad + sum(row_h) + gap * (len(rows) - 1) + pad
    sh = Image.new('RGB', (W, H), WASH); d = ImageDraw.Draw(sh)
    d.rectangle([0, 0, W, 8], fill=NAVY)
    d.text((pad, 40), sub.upper(), font=font(16, 700), fill=RED)
    d.rectangle([pad, 70, pad + 60, 73], fill=RED)
    d.text((pad, 86), title, font=font(34, 800), fill=NAVY)
    y = head + pad
    for r, rh in zip(rows, row_h):
        x = pad
        for im, lab in r:
            sh.paste(im, (x, y)); d.text((x, y + im.height + 12), lab, font=font(15, 600), fill=SLATE); x += thumb_w + gap
        y += rh + gap
    sh.save(os.path.join(OUT, out)); print('wrote', out, sh.size)

POSTS = [('listing-land', 'Just shot, land'), ('listing-commercial', 'Just shot, commercial'), ('listing-residential', 'Just shot, residential'),
         ('bts', 'Behind the scenes'), ('stat', 'Result'), ('announce', 'Announcement'), ('hiring', 'Hiring')]
TPL = [('listing-commercial', 'Listing'), ('bts', 'Behind the scenes'), ('stat', 'Result'), ('announce', 'Announcement'), ('hiring', 'Hiring')]
PH = {'interior': 'tight interior, mc_retouched_05', 'aerial': 'wide aerial, mc_rosehill_16', 'portrait': 'portrait original, mc_retouched_08', 'boundary': 'red boundary, mc_fullres_12'}

cells = []
for size in ('square', 'portrait'):
    for k, lab in POSTS: cells.append(('posts/%s-%s.png' % (k, size), '%s, %s' % (lab, '1080x1080' if size == 'square' else '1080x1350')))
sheet(cells, 7, 'primary.png', 'Feed posts, five templates, 1080x1080 and 1080x1350', 'Marathon Creative, social feed system', 300)

for k, lab in PH.items():
    cells = []
    for size in ('square', 'portrait'):
        for t, tl in TPL: cells.append(('photo-test/%s-%s-%s.png' % (t, size, k), '%s, %s' % (tl, size)))
    sheet(cells, 5, 'photo-%s.png' % k, 'Every template on the same %s' % lab, 'Photo robustness test')

for size in ('square', 'portrait'):
    cells = []
    for t, tl in [('listing', 'Listing'), ('bts', 'Behind the scenes'), ('stat', 'Result'), ('announce', 'Announcement'), ('hiring', 'Hiring')]:
        for k in ('bright', 'busy', 'tall', 'boundary'): cells.append(('stress/stress-%s-%s-%s.png' % (t, size, k), '%s, double copy, %s' % (tl, k)))
    sheet(cells, 4, 'stress-%s.png' % size, 'Copy twice as long as allowed, on the four hardest photos, %s' % ('1080x1080' if size == 'square' else '1080x1350'), 'Long copy test')

LWT = [('listing-commercial', 'Listing'), ('bts', 'Behind the scenes'), ('stat', 'Result, stat label'), ('announce', 'Announcement'), ('hiring', 'Hiring')]
for size in ('square', 'portrait'):
    cells = []
    for lk, ll in (('word', '34 letter word'), ('url', '55 character URL')):
        for k in ('interior', 'aerial', 'portrait'):
            for t, tl in LWT: cells.append(('longword/%s-%s-%s-%s.png' % (t, size, lk, k), '%s, %s, %s' % (tl, ll, k)))
    sheet(cells, 5, 'longword-%s.png' % size, 'One long unbroken word, through the URL param, %s' % ('1080x1080' if size == 'square' else '1080x1350'), 'Long word test, width floor then forced break', 300)

EDGE = [('label-beside', 'Stat label, long word beside'), ('label-stacked', 'Stat label, long word stacked'), ('stat-asis', 'Stat $1,250,000, as typed'),
        ('stat-digits', 'Stat 1234567890, as typed'), ('stat-refused', 'Stat $1,250,000,000, refused'), ('fact-refused', 'Fact $1,250,000,000, refused'),
        ('cta-word', 'Button, 38 letter word'), ('cta-url', 'Button, careers URL'), ('cta-long', 'Button, 41 characters')]
for size in ('square', 'portrait'):
    sheet([('edge/%s-%s.png' % (k, size), lab) for k, lab in EDGE], 3, 'edge-%s.png' % size,
          'Long words break, figures print as typed or refuse, %s' % ('1080x1080' if size == 'square' else '1080x1350'),
          'Long word and figure test', 360)
    sheet([('edge/check-%s-%s.png' % (k, size), lab) for k, lab in EDGE], 3, 'edge-check-%s.png' % size,
          'The same posts with the copy check, %s' % ('1080x1080' if size == 'square' else '1080x1350'), 'Long word and figure test, engine report', 480)