Skip to content

feat(hogs): bump @posthog/brand to 0.17.5 and add HoggieImage - #22638

Draft
rafaeelaudibert wants to merge 1 commit into
masterfrom
chore/posthog-brand-0.17.3
Draft

rafaeelaudibert wants to merge 1 commit into
masterfrom
chore/posthog-brand-0.17.3

Conversation

@rafaeelaudibert

@rafaeelaudibert rafaeelaudibert commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

This is PR 1 of 4 in a stack. The stack replaces the old hedgehog images on posthog.com with hoggies from @posthog/brand. Each PR is based on the PR before it. Review them in this order:

  1. feat(hogs): bump @posthog/brand to 0.17.5 and add HoggieImage #22638 (this PR): updates the brand package and adds the parts that the other PRs use.
  2. feat(hogs): replace old hedgehog images with brand hoggies #22640: replaces the old images with hoggies.
  3. feat(hogs): build SlicedHog from the brand slices art #22644: builds the animated SlicedHog on /ai from the brand art.
  4. chore(hogs): remove dead components and unused hog images #22645: removes dead code and the image files that nothing uses now.

Summary

This PR does four things:

  • Updates @posthog/brand from 0.13.0 to 0.17.5. Version 0.17.5 adds the finger-guns hoggie, which feat(hogs): replace old hedgehog images with brand hoggies #22640 uses. I compared the two versions: 0.17.5 only adds files and exports. It removes none.
  • Adds a webpack alias, hoggies. Code imports a hoggie PNG with import hedgehogStopPng from 'hoggies/stop.png', and webpack bundles the file.
  • Adds a HoggieImage component. It shows a hoggie PNG, and it can mirror or crop the hoggie in CSS. The site does not need extra image files for a mirrored or cropped hoggie.
  • Replaces the round hedgehog avatar. A new file, src/images/hog-profile.png, replaces three old images. It is the brand "sitting" hoggie, cut to a bust on a round background.

We use the PNG files, not the brand SVG components. Each SVG component adds approximately 150 KB of gzipped JavaScript to the page. A PNG file is approximately 49 KB, and the browser loads it as an image.

This PR has no visible change except the avatar. The other PRs in the stack use the alias and HoggieImage.

🗺️ PR tour

Stop 1: The package update (diff, lockfile diff)

@posthog/brand changes from 0.13.0 to 0.17.5.

"@posthog/brand": "0.17.5",

⚠️ I edited pnpm-lock.yaml by hand. pnpm add fails on the repo trust policy (no-downgrade) for other locked packages that this change does not touch. I copied the version and the integrity hash from pnpm view @posthog/brand@0.17.5, then ran pnpm install --frozen-lockfile, which passed.

Stop 2: The hoggies alias (diff)

The alias points to the PNG folder in the brand package.

posthog.com/gatsby-node.ts

Lines 107 to 119 in bd2a7a6

// Brand hoggie PNGs as plain files, so Gatsby's image loader returns a bundled URL:
// import hedgehogStopPng from 'hoggies/stop.png'
// The package's own `@posthog/brand/hoggies/png/*` modules resolve to a JS module here.
hoggies: path.resolve(
__dirname,
'node_modules',
'@posthog',
'brand',
'dist',
'generated',
'hoggies',
'png'
),

The package also has its own @posthog/brand/hoggies/png/* modules. Those modules use new URL('./x.png', import.meta.url), which the Gatsby 4 webpack rules do not resolve to a file URL. The alias gives a direct path to each PNG file, so Gatsby's normal image loader handles it.

Stop 3: HoggieImage (diff, README)

The component shows a hoggie PNG. It has no state and no effects. It renders a <span> (the box) that holds an <img>, the same layout as CloudinaryImage, so a component can render either one with the same classes. It uses a <span>, not a <div>, so it is valid inside a link or a paragraph.

  • className styles the box. Size, position, margin, and float classes go here.
  • imgClassName styles the <img>.
  • mirror flips the hoggie with -scale-x-100.
  • crop={[x, y, width, height]} shows only one box of the art, in the units of the 1000×1000 PNG, measured before the mirror.
  • alt defaults to '', because most hoggies are decorative.
  • Other <img> props (loading, title, width) go to the <img>.

type FullArt = {
crop?: undefined
/** Classes for the `<img>`. */
imgClassName?: string
}
type CroppedArt = {
/** Shows only this box of the art. The box is the visible image, so size it with `className`. */
crop: HoggieCrop
imgClassName?: never
}
export type HoggieImageProps = BaseProps & (FullArt | CroppedArt)

The props type does not allow imgClassName together with crop. With a crop, the box is the visible image, so its classes go on className:

const [x, y, width, height] = crop
// The flip turns the image around its own center, so a mirrored crop starts from the other side
const left = mirror ? ART_SIZE - x - width : x
return (
<span className={`inline-block overflow-hidden ${className}`} style={{ aspectRatio: `${width} / ${height}` }}>
<img
{...imgProps}
src={src}
alt={alt}
className={`block max-w-none ${flip}`}
style={{
...style,
width: `${(ART_SIZE / width) * 100}%`,
marginLeft: `${(-left / width) * 100}%`,
marginTop: `${(-y / width) * 100}%`,
}}
/>
</span>
)

The box is an overflow-hidden window with the aspect ratio of the crop. The <img> inside is larger than the window, and negative margins move it so that the crop fills the window. A margin in percent is a percent of the box width, also for margin-top, so one formula works for both axes. The <img> stays in the flow, so the box needs no position class, and a caller can make the box absolute. The crop's width, margin-left, and margin-top come after the caller's style, so a caller cannot move the crop by accident.

Each brand PNG has empty space around the art, and most old images had none. To show a hoggie at the size of the old image, #22640 crops it to the box around its art. The README has the command that prints that box.

⚠️ Three of the 203 brand PNGs are narrower than 1000 px (burning-money, mailbox, workmaxxing), so a crop of them would be wrong. None of them is cropped. The code and the README say not to crop them. To support them, the component must know each image's width, which needs a measurement after load or a lookup table. That is more code for three images that nobody crops.

The README explains the props, the layout, and how to render data that mixes Cloudinary URLs and hoggie PNGs.

Stop 4: CloudinaryImage (diff)

The only change is an export on the existing isCloudinaryImage check.

export const isCloudinaryImage = (url: string): boolean => {
const cloudinaryUrlPattern = new RegExp(`https://res.cloudinary.com/${process.env.GATSBY_CLOUDINARY_CLOUD_NAME}/`)
return cloudinaryUrlPattern.test(url)
}

#22640 uses it in components that get both kinds of URL. For example, some product pages still have a Cloudinary hog and others now have a hoggie. Those components use isCloudinaryImage to select CloudinaryImage or HoggieImage. CloudinaryImage itself does not know about hoggies.

Stop 5: The new avatar (image, script)

src/images/hog-profile.png replaces three images:

  • hog-9.png: the avatar for a team member who has no photo.
  • thumbnail_max.png: the PostHog AI avatar on forum replies.
  • max.png: the PostHog AI avatar in the docs chat. This is the same picture as thumbnail_max.png.

scripts/hog-images/make-hog-profile.sh makes the file from the brand "sitting" hoggie with ImageMagick. It has the same format as hog-9.png: round, with transparent corners, at 400×400.

The file is in the repo and webpack bundles it. It is not on Cloudinary, because Cloudinary does not copy new files from the repo.

Stop 6: The avatar call sites

Each site imports hog-profile.png in place of the old Cloudinary URL:

  • TeamMember (diff): three fallbacks for a team member with no photo.
  • Academy/PostQuote (diff), Careers/MegaQuote (diff), Careers/TeamQuotes (diff), Products/Slides/VideosSlide (diff): the same fallback in quotes and video credits.
  • Squeak/components/Question (diff): the PostHog AI avatar on forum replies.
  • useInkeepSettings (diff): the PostHog AI avatar in the docs chat.

<img src={hogProfile} alt="" className="w-24" />

⚠️ These sites use a plain <img>, not CloudinaryImage or HoggieImage. On master, CloudinaryImage drops className for a URL that is not on Cloudinary. hog-profile.png is not a brand hoggie, so HoggieImage does not apply. Where the old code put a size on the wrapper, the new code moves that class to the <img> or keeps the wrapper <div> (in VideosSlide).

Stop 7: Docs (diff)

A note in the Hogpedia README said that PNG imports need a webpack rule first. It now points to the hoggies alias.

🔍 Reviewer's guide

Testing done

Check Command / method Result
Install pnpm install --frozen-lockfile with the hand-edited lockfile Passes. node_modules/@posthog/brand is 0.17.5
Package contents Compared the file lists and exports of the 0.17.3 and 0.17.5 tarballs 0.17.5 only adds files (cello, finger-guns, maestro, make-it-rain, pepe-silvia-1, pepe-silvia-2)
Formatting prettier --check on the changed files No changes needed
Lint eslint on the changed files No new warnings or errors
Types tsc with a temporary config that includes the changed files No new errors
HoggieImage props tsc on a test file with each prop combination Accepts the full art, a crop, and a crop that can be undefined. Rejects crop with imgClassName
Production build CI "Build & deploy preview" on this branch Passes on the head commit of this PR
Dev server pnpm start, loaded the pages of the full stack Every hoggie loads. No new console errors

Not tested:

  • Screenshots of the avatar on a live page. hog-9.png shows only for a team member with no photo, and no page shows one today. The PostHog AI avatar on forum replies shows only while PostHog AI answers a question that a person just posted, and the docs chat avatar shows only after a person asks the docs AI a question. To capture them, I must post to the real forum or send a question to the real docs AI. The comparison below shows the old images and the new image.

Screenshots

The avatar is the only visible change in this PR. The PNG is the same in light and dark mode, and its size comes from the call site, so the window width does not change it.

Old: hog-9.png Old: thumbnail_max.png and max.png New: hog-profile.png
avatar-old-hog9 avatar-old-max avatar-new

What to look at

  1. The hoggies alias points into the package's dist/generated folder. That path is not part of the package's public exports. If a later brand version moves the folder, every hoggie import in the stack fails at build time. The package's own png/* exports do not work with the Gatsby 4 webpack rules, so this was the most direct option. A brand version update must check this path.
  2. The crop math in HoggieImage. A mistake here moves or clips every cropped hoggie in feat(hogs): replace old hedgehog images with brand hoggies #22640 (for example /services, /self-driving, /ai, /mcp, and the product page heroes). A mirrored crop starts from the other side of the art, because the image flips around its own center.
  3. The hand-edited lockfile. The integrity hash must match the registry. pnpm install --frozen-lockfile checks it, and it passed.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview

Status Details Updated (UTC)
🟢 Ready View preview Nov 21, 2026 07:47PM

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Vale prose linter → found 2 errors, 21 warnings, 0 suggestions in your markdown

Full report → Copy the linter results into an LLM to batch-fix issues.

Linter being weird? Update the rules!

src/components/HoggieImage/README.md — 0 errors, 15 warnings, 0 suggestions
Line Severity Message Rule
3:9 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
3:59 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
5:14 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
5:32 warning 'Cloudinary' is a possible misspelling. PostHogBase.Spelling
23:53 warning 'hoggies' is a possible misspelling. PostHogBase.Spelling
23:93 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
25:36 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
41:81 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
41:131 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
49:7 warning 'hoggies' is a possible misspelling. PostHogBase.Spelling
49:38 warning 'px' is a possible misspelling. PostHogBase.Spelling
51:14 warning 'Cloudinary' is a possible misspelling. PostHogBase.Spelling
51:34 warning 'hoggies' is a possible misspelling. PostHogBase.Spelling
53:17 warning 'Cloudinary' is a possible misspelling. PostHogBase.Spelling
53:53 warning 'hoggie' is a possible misspelling. PostHogBase.Spelling
src/components/Hogpedia/README.md — 2 errors, 6 warnings, 0 suggestions
Line Severity Message Rule
21:4 warning 'Where the Main Page gets its content' heading should be in sentence case, and product names should be capitalized. PostHogBase.SentenceCase
33:207 warning 'taskbar's' is a possible misspelling. PostHogBase.Spelling
74:175 warning Use 'IDs' instead of 'ids'. Vale.Terms
83:261 warning 'inlines' is a possible misspelling. PostHogBase.Spelling
85:195 warning 'inlined' is a possible misspelling. PostHogBase.Spelling
87:3 warning Use American English. Use 'center' instead of 'Centre'. PostHogBase.AmericanEnglish
91:190 error Hi, Andy here... use an en dash ( – ) with spaces. On Mac, holding down the Option and hyphen key will give you an en dash. PostHogBase.EnDash
91:654 error Hi, Andy here... use an en dash ( – ) with spaces. On Mac, holding down the Option and hyphen key will give you an en dash. PostHogBase.EnDash

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Bundle report

Total JS (gzip)

12.22 MiB (+1.0 KiB / +0.0%)

Largest changed named chunks
Chunk Gzip Δ vs master
e9779244.js 194.1 KiB new
82bf887a.js 144.7 KiB new
2d8cec25.js 137.5 KiB new
166367b1.js 134.3 KiB new
ade17efd.js 95.8 KiB new
55d57a4d.js 94.7 KiB new
3b29d609.js 94.6 KiB new
45aae769.js 89.7 KiB new
4623c1e7.js 88.9 KiB new
3385df9c.js 88.9 KiB new
e0aad144.js 85.2 KiB new
66b5ac38.js 85.1 KiB new
86398d0d.js 84.9 KiB new
e37051bc.js 79.4 KiB new
5041cf6e.js 78.6 KiB new

Eager graph (modules shipped in each entrypoint's initial chunks)

Entrypoint Eager size Budget Modules
✅ app 11.15 MiB (-1.9 KiB / -0.0%) report-only 1118
Largest modules in the app closure
Module Size
css ./node_modules/.pnpm/css-loader@5.2.7_webpack@5.101.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/postcss-loader@4.3.0_postcss@8.5.6_webpack@5.101.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css 1023.8 KiB
./src/components/Stickers/Stickers.tsx 696.4 KiB
./node_modules/.pnpm/@posthog+brand@0.17.5_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/puzzle.mjs 388.2 KiB
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js 354.8 KiB
./node_modules/.pnpm/react-markdown@8.0.7_@types+react@16.14.66_react@18.3.1/node_modules/react-markdown/lib/react-markdown.js + 88 modules 351.4 KiB
./node_modules/.pnpm/@posthog+brand@0.17.5_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/basketball-coach.mjs 337.3 KiB
./node_modules/.pnpm/framer-motion@14.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs + 126 modules 287.2 KiB
./node_modules/.pnpm/cloudinary-core@2.14.0_lodash@4.17.21/node_modules/cloudinary-core/cloudinary-core.js 281.9 KiB
./src/components/SearchUI/index.tsx + 87 modules 273.1 KiB
./gatsby-browser.tsx + 60 modules 259.6 KiB
./node_modules/.pnpm/@posthog+brand@0.17.5_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/construction-1.mjs 248.7 KiB
./src/components/Pricing/PricingSlider/Slider.tsx + 87 modules 240.2 KiB
./node_modules/.pnpm/@posthog+brand@0.17.5_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/construction-2.mjs 228.0 KiB
./node_modules/.pnpm/@posthog+brand@0.17.5_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/magnifying-glass.mjs 221.9 KiB
./src/hooks/useProduct.ts + 18 modules 165.0 KiB

Eager-graph budgets are report-only until a baseline is established. Sizes are gzip of public/**/*.js; eager size is webpack module source bytes for the modules actually shipped in the entrypoint's initial chunks (post-tree-shake).

@rafaeelaudibert
rafaeelaudibert removed this pull request from stack #22646 November 21, 2026 02:31
@rafaeelaudibert
rafaeelaudibert force-pushed the chore/posthog-brand-0.17.3 branch from 3fe5eff to 3956d3e Compare November 21, 2026 02:31
@rafaeelaudibert rafaeelaudibert changed the title chore(deps): bump @posthog/brand to 0.17.3 and bundle hoggie PNGs feat(hogs): bump @posthog/brand to 0.17.3 and add the hoggies alias Nov 21, 2026
@rafaeelaudibert
rafaeelaudibert force-pushed the chore/posthog-brand-0.17.3 branch 2 times, most recently from 9e8ad29 to c0b2398 Compare November 21, 2026 05:15
@rafaeelaudibert rafaeelaudibert changed the title feat(hogs): bump @posthog/brand to 0.17.3 and add the hoggies alias feat(hogs): bump @posthog/brand to 0.17.5 and add HoggieImage Nov 21, 2026
@rafaeelaudibert
rafaeelaudibert marked this pull request as ready for review November 21, 2026 15:07
@rafaeelaudibert
rafaeelaudibert requested a review from a team as a code owner November 21, 2026 15:07

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed c0b2398: 2 Should fix.

This is the last automatic review of this pull request. Comment @posthog review to review new changes.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

Comment thread src/components/HoggieImage/index.tsx Outdated
Comment on lines +54 to +56
width: `${(HOGGIE_SIZE / width) * 100}%`,
left: `${(-left / width) * 100}%`,
top: `${(-y / height) * 100}%`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Account for non-square hoggies when calculating crops

When crop receives mailbox.png or burning-money.png, their actual 910×1000 dimensions invalidate the square-image assumption. Setting the image width from HOGGIE_SIZE enlarges both axes incorrectly, so crop coordinates select the wrong region and mirrored crops shift horizontally. Calculate scaling and mirrored offsets from the source dimensions.

<Avatar
className={` ${isInForum ? 'size-8' : 'w-[25px] h-[25px]'} rounded-full`}
image="https://res.cloudinary.com/dmukukwp6/image/upload/v1688579513/thumbnail_max_c5dd553db8.png"
image={hogProfile}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 · Provide rendered screenshots for the avatar replacements

When MaxReply renders, the replacement appears inside Avatar with borders and a logo overlay; comparing standalone PNGs does not verify that composition or the other changed consumers. AGENTS.md:35 explicitly blocks visual changes without rendered before/after evidence. Capture affected areas at narrow and wide sizes in both themes.

@rafaeelaudibert
rafaeelaudibert force-pushed the chore/posthog-brand-0.17.3 branch from c0b2398 to 331335d Compare November 21, 2026 15:37
@rafaeelaudibert
rafaeelaudibert marked this pull request as draft November 21, 2026 19:21
Adds the `hoggies` webpack alias for the brand PNGs, a HoggieImage component
that shows a hoggie with an optional mirror and crop, and the hog-profile
avatar. CloudinaryImage only exports its isCloudinaryImage check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rafaeelaudibert
rafaeelaudibert force-pushed the chore/posthog-brand-0.17.3 branch from 331335d to bd2a7a6 Compare November 21, 2026 19:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants