Pages
Templates page
The site's templates page, from library items: the header, the templates wall as the hero, the automation run, what each template brings back (a centered head over the row fan), the questions, the close with two buttons and the footer.
Install
React apps get the React files; every other stack gets the web component.
npx spyglass-ds add templates-page<script type="module" src="/spyglass-ds/elements/templates-page.js"></script>Build your own
- Ad library
- Creator sourcing tool
- Competitor monitor
- Trend tracker
Ready-made playbooks that run inside your agent on Spyglass data.
Coming soon
“Acme Skin added $500K in monthly subscription revenue in less than 60 days”
Hands working balm in on a red coat sleeve. Live since Sun 8 Nov. Running 8 days. Hook: hands at work.
Close-ups of a face and a lip tint. New on Saturday. A launch announcement. Live 2 days.
A morning skincare routine in a striped top. Organic post. A morning routine. Posted Thu 12 Nov.
Denim, a cap and a tee on a grey set. New on Thursday. Holiday gifting push. Running 4 days.
A bottle and its texture in soft light. Live since Wed 11 Nov. Second cut of this video. Running 5 days.
Hands shaping dough beside a candle. New on Tuesday. Holiday campaign. Running 6 days.
Racks and boxes in a dark studio. New on Friday. Archive sale. Running 3 days.
Sunglasses and a lip treatment. Live since Sun 8 Nov. Running 8 days. In 2 live ads.
A burgundy bag at a kitchen table. A new campaign film. Live since Sun 8 Nov. Running 8 days.
A headband and a cooling roller. Organic post. A skin prep routine. Posted Sat 14 Nov.
Gift kits and bottles on dark shelves. New on Thursday. A second ad on Friday. Running 4 days.
A puffer, a hoodie and a tee. New on Saturday. Live 2 days. A short film.
A candle lit at a dark table. New on Friday. Holiday candles. A second ad on Sunday.
Amber bottles and a gift in candlelight. New on Wednesday. Running 5 days.
A varsity jacket and hoodies. Paused Thursday. Ran 3 to 12 Nov. A holiday drop.
A holiday table and a candle. Paused Wednesday. Ran 4 to 11 Nov. A short film.
What each template brings back
Coming soon. Real ads, creators and posts, the kind each one will send your agent.
- Ad library: coming soon. Every morning at 8:00, every ad from the brands you follow.
- Creator sourcing tool: coming soon. Every Friday at 10:00, creators who fit your audience, place and size.
- Competitor monitor: coming soon. Every Monday at 8:00, a competitor's new ads, pages and creators.
- Trend tracker: coming soon. Every day at 7:00, the hooks gaining share in your category.
Frequently asked questions
What a template is, where it runs and what it costs.
Read the docsA ready-made playbook your agent runs on Spyglass data. It holds the question, the data it needs and what to send back. You start from something that already works.
Inside your agent, through the Spyglass MCP server. Each run reads Spyglass data and brings the answer back to the chat.
Every template runs on a schedule by default, like every Monday at 8:00. Run it once in test mode first to see what comes back.
Each run uses credits from the same pool as the API and the MCP server. Every account gets 500 free credits a month.
Templates run on the Spyglass API. Start today
500 free credits every month. No card required.
Usage
A page introducing templates or playbooks. Edit lib/pages/templates.ts or pass content; fan (the fan slot in web components) takes your own arrangement of the rows in place of the row fan.
Never
- Another brand's ads or creators in the wall, the run or the rows: pass your own or keep the placeholders
- More than one White button in a section
- A schedule or a price the template does not state
The wall holds a still frame with reduced motion and the run holds its batch at rest. Each row is a link to its use case with the template's schedule for assistive tech. The row items are Acme placeholder squares; pass your own pictures through content.cities.rows[].items[].src. sections lists the sections to show, in order (wall, run, cities, faq, close); a key left out is not shown. blocks.wall.pictures fills the wall, blocks.run.items the run, and each city row's items take image slots (the generated blanks carry data-ds-placeholder). menus passes the header menus (the live card's picture, the use cases' shots).
Adds with it: ascii-trail, automation-run, creative-card, faq-block, page-close, row-fan, site-footer, site-header, templates-wall
Props
The web component takes the same as attributes or properties (<spyglass-templates-page>); title is heading there.
<TemplatesPage>
| Prop | Type | Default |
|---|---|---|
content | TemplatesPageContent | |
fan | ReactNode Your own arrangement of the rows in place of the row fan. | |
blocks | TemplatesBlocks Each block's data, pictures included: the wall's `pictures` and the run's `items`. | {} |
menus | HeaderMenus The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default. | |
sections | readonly TemplatesSection[] The sections to show, in order; all of them in the page order by default (leave one out to omit it). | |
className | string |
Examples
The same example in React and as web components; both render identically.
import { TemplatesPage } from '@/react/components/pages/TemplatesPage'
// The templates page with Acme's copy and neutral placeholders in the wall and the run.
export default function Page() {
return <TemplatesPage />
}<!-- The templates page with Acme's copy and neutral placeholders in the wall and the run. -->
<spyglass-templates-page></spyglass-templates-page>Source
import { type ReactNode, Fragment } from 'react'
import { AsciiTrail } from '@/react/components/visuals/AsciiTrail'
import { SiteHeader } from '@/react/components/site/SiteHeader'
import { RowFan } from '@/react/components/site/RowFan'
import { AutomationRun } from '@/react/components/site/AutomationRun'
import { PageClose } from '@/react/components/site/PageClose'
import { TemplatesWall } from '@/react/components/blocks/TemplatesWall'
import { FaqBlock } from '@/react/components/blocks/FaqBlock'
import { SiteFooter } from '@/react/components/blocks/SiteFooter'
import { templatesPageContent, type TemplatesPageContent, templatesSections, type TemplatesSection, type TemplatesBlocks } from '@/lib/pages/templates'
import { cn } from '@/react/lib/cn'
import { pageSections } from '@/lib/image'
import type { HeaderMenus } from '@/lib/site-header'
// The site's templates page (app/templates): the header, the templates wall as the hero (an h1 filling the window under
// the header), the automation run (a quote over the batch drifting by), what each template brings back
// (pages/TemplatesPage/TemplateCities: a centered head and a row per template, its name 32/36, 44/48 at 768, 64/68 at
// 1024, each row a link whose items fan out in perspective, the row fan), the questions, the close with a White and a quiet
// button, and the footer. `fan` replaces the row fan with your own arrangement of the rows; `content` replaces
// the copy (lib/pages/templates.ts).
export interface TemplatesPageProps {
content?: TemplatesPageContent
/** Your own arrangement of the rows in place of the row fan. */
fan?: ReactNode
/** Each block's data, pictures included: the wall's `pictures` and the run's `items`. */
blocks?: TemplatesBlocks
/** The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default. */
menus?: HeaderMenus
/** The sections to show, in order; all of them in the page order by default (leave one out to omit it). */
sections?: readonly TemplatesSection[]
className?: string
}
const WRAP = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'
export function TemplatesPage({ content: c = templatesPageContent, fan, blocks = {}, menus, sections, className }: TemplatesPageProps) {
const t = c.cities
const parts: Record<TemplatesSection, ReactNode> = {
wall: <TemplatesWall hero content={c.wall} pictures={blocks.wall?.pictures} id="templates" />,
run: <AutomationRun items={blocks.run?.items} id="templates-run" />,
cities: (
<section id={t.id} aria-labelledby={`${t.id}-heading`} className="ds-tpl-cities overflow-x-clip pt-(--ds-layout-section)">
<div className={cn(WRAP, 'grid justify-items-center text-center')}>
<h2 id={`${t.id}-heading`} className="type-section [text-box:trim-start_cap_alphabetic]">{t.headline}</h2>
<p className="mt-4 max-w-(--ds-layout-measure) type-body-lg text-pretty text-fg-soft">{t.lead}</p>
</div>
<div className="ds-tpl-cities-rows relative">
{fan ?? <RowFan rows={t.rows.map((r) => ({ key: r.key, name: r.name, href: r.href, cta: r.line, srLabel: `: ${t.status.toLowerCase()}. ${r.line}`, items: r.items }))} />}
</div>
</section>
),
faq: (
<div className={cn(WRAP, 'py-(--ds-layout-section)')}>
<FaqBlock id={c.faq.id} title={c.faq.headline} body={c.faq.lead} action={c.faq.docs} items={c.faq.items} />
</div>
),
close: <PageClose id="templates-close" lines={c.close.lines} note={c.close.note} primary={c.close.primary} secondary={c.close.secondary} control={null} />,
}
return (
<div data-ds="templates-page" className={cn('isolate bg-surface text-fg', className)}>
<AsciiTrail mode="page" />
<style href="ds-templates-page" precedence="ds">{css}</style>
<SiteHeader menus={menus} links={c.chrome.header.nav} secondary={c.chrome.header.secondary} cta={c.chrome.header.cta} />
<main id="main">
{pageSections(templatesSections, sections).map((k) => <Fragment key={k}>{parts[k]}</Fragment>)}
</main>
<SiteFooter columns={c.chrome.footer.columns} legal={c.chrome.footer.legal} />
</div>
)
}
export default TemplatesPage
const css = `
.ds-tpl-cities { padding-bottom: calc(var(--ds-layout-section) - var(--ds-space-lg)); }
.ds-tpl-cities-rows { margin-top: var(--ds-space-3xl); }
@media (min-width: 768px) { .ds-tpl-cities-rows { margin-top: calc(var(--ds-space-4xl) + var(--ds-space-sm)); } }
@media (min-width: 1024px) { .ds-tpl-cities { padding-bottom: var(--ds-layout-section); } }
`// Joins class names, skipping falsy ones: cn('a', on && 'b', ['c', undefined]). It does not merge conflicting
// utilities (no tailwind-merge), as Vue's class binding does not: the library's classes are written not to compete,
// and a className from the caller is appended after them, as Vue appends a fallthrough class.
export type ClassValue = string | false | null | undefined | 0 | ClassValue[]
export function cn(...values: ClassValue[]): string {
const out: string[] = []
for (const v of values) {
if (!v) continue
if (Array.isArray(v)) {
const s = cn(...v)
if (s) out.push(s)
}
else out.push(v)
}
return out.join(' ')
}import { html } from 'lit'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import { templatesPageContent, type TemplatesPageContent, templatesSections, type TemplatesSection, type TemplatesBlocks } from '@/lib/pages/templates'
import '@/elements/components/site/site-header'
import '@/elements/components/site/automation-run'
import '@/elements/components/site/row-fan'
import '@/elements/components/site/page-close'
import '@/elements/components/blocks/templates-wall'
import '@/elements/components/blocks/faq-block'
import '@/elements/components/blocks/site-footer'
import '@/elements/components/visuals/ascii-trail'
import styles from 'virtual:tw'
import { pageSections } from '@/lib/image'
import { runPlaceholders } from '@/lib/automation-run'
import { headerMenus, type HeaderMenus } from '@/lib/site-header'
// TemplatesPage.tsx as <spyglass-templates-page>: the header, the templates wall as the hero, the automation run, what
// each template brings back (a centered head over the row fan), the
// questions, the close with two buttons and the footer. `content` replaces the copy (lib/pages/templates.ts); the `fan`
// slot replaces the row fan with your own arrangement of the rows.
const WRAP = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'
/**
* @summary The templates page template.
* @slot fan - Your own arrangement of the rows in place of the row fan.
*/
export class TemplatesPage extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="templates-page"]'))
static properties = { content: { type: Object }, sections: { type: Array }, blocks: { type: Object }, menus: { type: Object } }
/** The page's copy (lib/pages/templates.ts by default). */
content: TemplatesPageContent = templatesPageContent
/** The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default. */
menus?: HeaderMenus
/** The sections to show, in order (a list of names); all of them in the page order by default. */
/** Each block's data, pictures included: the wall's `pictures` and the run's `items`. */
blocks: TemplatesBlocks = {}
sections?: TemplatesSection[]
render() {
const c = this.content ?? templatesPageContent
const t = c.cities
const rows = this.hasSlot('fan') ? html`<slot name="fan"></slot>` : html`<spyglass-row-fan .rows=${t.rows.map((r) => ({ key: r.key, name: r.name, href: r.href, cta: r.line, srLabel: `: ${t.status.toLowerCase()}. ${r.line}`, items: r.items }))}></spyglass-row-fan>`
const b = this.blocks ?? {}
const parts: Record<TemplatesSection, unknown> = {
wall: html`<spyglass-templates-wall hero .content=${c.wall} .pictures=${b.wall?.pictures} section-id="templates"></spyglass-templates-wall>`,
run: html`<spyglass-automation-run .items=${b.run?.items ?? runPlaceholders} section-id="templates-run"></spyglass-automation-run>`,
cities: html`<section id=${t.id} aria-labelledby=${`${t.id}-heading`} class="ds-tpl-cities overflow-x-clip pt-(--ds-layout-section)"><div class=${`${WRAP} grid justify-items-center text-center`}><h2 id=${`${t.id}-heading`} class="type-section [text-box:trim-start_cap_alphabetic]">${t.headline}</h2><p class="mt-4 max-w-(--ds-layout-measure) type-body-lg text-pretty text-fg-soft">${t.lead}</p></div><div class="ds-tpl-cities-rows relative">${rows}</div></section>`,
faq: html`<div class=${`${WRAP} py-(--ds-layout-section)`}><spyglass-faq-block head-id=${c.faq.id} heading=${c.faq.headline} body=${c.faq.lead} .action=${c.faq.docs} .items=${c.faq.items}></spyglass-faq-block></div>`,
close: html`<spyglass-page-close close-id="templates-close" .lines=${c.close.lines} note=${c.close.note} .primary=${c.close.primary} .secondary=${c.close.secondary} connect="false"></spyglass-page-close>`,
}
return html`<div data-ds="templates-page" class="isolate bg-surface text-fg"><spyglass-ascii-trail mode="page"></spyglass-ascii-trail><spyglass-site-header .menus=${this.menus ?? headerMenus} .links=${c.chrome.header.nav} .secondary=${c.chrome.header.secondary} .cta=${c.chrome.header.cta}></spyglass-site-header><main id="main">${pageSections(templatesSections, this.sections).map((k) => parts[k])}</main><spyglass-site-footer .columns=${c.chrome.footer.columns} legal=${c.chrome.footer.legal}></spyglass-site-footer></div>`
}
}
define('templates-page', TemplatesPage).ds-tpl-cities { padding-bottom: calc(var(--ds-layout-section) - var(--ds-space-lg)); }
.ds-tpl-cities-rows { margin-top: var(--ds-space-3xl); }
@media (min-width: 768px) { .ds-tpl-cities-rows { margin-top: calc(var(--ds-space-4xl) + var(--ds-space-sm)); } }
@media (min-width: 1024px) { .ds-tpl-cities { padding-bottom: var(--ds-layout-section); } }Reference: Site app/templates/page.tsx (V2Templates as h1, AutomationRun with templatesPage.run, TemplateCities, V3Faq, PageClose with control null) and pages/TemplatesPage/TemplateCities(.module.css), tokens.css 840-931: the head trimmed at the cap, the lead 16px under it, the rows 48px under (72 at 768), each row padded 16px with 128px under it on phones (136 at 768, 16 from 1024 with 40 between rows), the rows as the row fan sets them (names 32/36, 44/48 at 768 and 64/68 at 1024, cards 72, 96 and 128); copy from content/pages/templates.ts and templatesCities.ts with third-party names left out.