Skip to content

Commit

Permalink
Fix too many files generated for CF pages
Browse files Browse the repository at this point in the history
They have a hard limit of 20k.
  • Loading branch information
rakyi committed Jul 29, 2024
1 parent b9795ba commit b469361
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/@ourworldindata/utils/src/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { traverseEnrichedBlock } from "./Util.js"
import { OwidGdoc, OwidGdocType, ImageMetadata } from "@ourworldindata/types"
import { match, P } from "ts-pattern"

export const AUTHOR_BYLINE_WIDTH = 48
export const THUMBNAIL_WIDTH = 100
export const LARGE_THUMBNAIL_WIDTH = 350

Expand All @@ -15,7 +14,7 @@ export function getSizes(
): number[] {
if (!originalWidth) return []
// ensure a thumbnail and author byline is generated
const widths = [AUTHOR_BYLINE_WIDTH, THUMBNAIL_WIDTH]
const widths = [THUMBNAIL_WIDTH]
// start at large thumbnail and go up by 500 to a max of 1350 before we just show the original image
let width = LARGE_THUMBNAIL_WIDTH
while (width < originalWidth && width <= 1350) {
Expand Down
2 changes: 0 additions & 2 deletions site/gdocs/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const gridSpan8 = generateResponsiveSizes(8)

export type ImageParentContainer =
| Exclude<Container, "sticky-right-left-heading-column">
| "author-byline"
| "thumbnail"
| "full-width"
| "span-5"
Expand All @@ -53,7 +52,6 @@ const containerSizes: Record<ImageParentContainer, string> = {
["datapage"]: gridSpan6,
["full-width"]: "100vw",
["key-insight"]: gridSpan5,
["author-byline"]: "48px",
["author-header"]: gridSpan2,
["span-5"]: gridSpan5,
["span-6"]: gridSpan6,
Expand Down
2 changes: 1 addition & 1 deletion site/gdocs/components/LinkedAuthor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function LinkedAuthor({
className="linked-author-image"
filename={author.featuredImage}
alt={author.name}
containerType="author-byline"
containerType="thumbnail"
shouldLightbox={false}
/>
) : undefined
Expand Down

0 comments on commit b469361

Please sign in to comment.