From cadacf5b060d399e50505bc52c5ddc842142e88b Mon Sep 17 00:00:00 2001
From: Ike Saunders
Date: Fri, 27 Oct 2023 22:51:05 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20support=20dateline=20in=20topic?=
=?UTF-8?q?=20page=20header?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/model/Gdoc/htmlToEnriched.ts | 18 +-----------------
site/gdocs/OwidGdocHeader.tsx | 3 +++
site/gdocs/topic-page.scss | 9 ++++++++-
3 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/db/model/Gdoc/htmlToEnriched.ts b/db/model/Gdoc/htmlToEnriched.ts
index de7ba430a72..ca972980dbc 100644
--- a/db/model/Gdoc/htmlToEnriched.ts
+++ b/db/model/Gdoc/htmlToEnriched.ts
@@ -846,23 +846,7 @@ function cheerioToArchieML(
.with({ tagName: "details" }, unwrapElementWithContext)
.with({ tagName: "div" }, (div) => {
const className = div.attribs.class || ""
- // Special handling for a div that we use to mark the "First published on..." notice
- if (className.includes("blog-info")) {
- const children = unwrapElementWithContext(div)
- const textChildren = children.content.filter(
- (c) => "type" in c && c.type === "text"
- ) as EnrichedBlockText[]
- const callout: EnrichedBlockCallout = {
- type: "callout",
- title: "",
- text: textChildren,
- parseErrors: [],
- }
- return {
- errors: [],
- content: [callout],
- }
- } else if (className.includes("pcrm")) {
+ if (className.includes("pcrm")) {
// pcrm stands for "preliminary collection of relevant material" which was used to designate entries
// that weren't fully polished, but then became a way to create a general-purpose "warning box".
const unwrapped = unwrapElementWithContext(element)
diff --git a/site/gdocs/OwidGdocHeader.tsx b/site/gdocs/OwidGdocHeader.tsx
index 2125f053e0d..91b3b89b2bf 100644
--- a/site/gdocs/OwidGdocHeader.tsx
+++ b/site/gdocs/OwidGdocHeader.tsx
@@ -139,6 +139,9 @@ function OwidTopicPageHeader({
})}
+
+ {content.dateline}
+
)
}
diff --git a/site/gdocs/topic-page.scss b/site/gdocs/topic-page.scss
index 4e5ffa41d05..b8b6f4cd27a 100644
--- a/site/gdocs/topic-page.scss
+++ b/site/gdocs/topic-page.scss
@@ -22,10 +22,17 @@
p.topic-page-header__byline,
.topic-page-header__byline a {
color: $blue-60;
+ margin-bottom: 0;
+ @include sm-only {
+ font-size: 0.875rem;
+ }
+ }
+
+ // Applies to either .topic-page-header__byline or .topic-page-header__dateline, if specified
+ p:last-child {
margin-bottom: 34px;
@include sm-only {
margin-bottom: 16px;
- font-size: 0.875rem;
}
}