Skip to content

Commit 0be33ed

Browse files
authored
Merge branch 'main' into add-image-for-galleries-main-image-caption
2 parents 4b2b40f + 2d3a78c commit 0be33ed

File tree

182 files changed

+1785
-10231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+1785
-10231
lines changed

dotcom-rendering/.storybook/decorators/splitThemeDecorator.tsx

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ interface Orientation {
2121
orientation?: 'horizontal' | 'vertical';
2222
}
2323

24+
type SplitThemeOptions = Orientation & {
25+
/** Allows the format heading to be omitted on the split theme decorator */
26+
hideFormatHeading?: boolean;
27+
};
28+
2429
/**
2530
* The `splitTheme` decorator displays a story simultaneously in both light and
2631
* dark mode.
@@ -226,6 +231,11 @@ type ThemeProps = {
226231
Story: Parameters<Decorator>[0];
227232
context: Context;
228233
colourScheme: ColourScheme;
234+
/**
235+
* For stories without article theming where we fallback to the default theme,
236+
* we can choose to omit the format heading as it's not relevant
237+
*/
238+
hideFormatHeading?: boolean;
229239
};
230240

231241
/**
@@ -242,7 +252,13 @@ type ThemeProps = {
242252
* `colourSchemeBackground` and `colourSchemeTextColour` parameters from the
243253
* story, or provides defaults when these are not supplied.
244254
*/
245-
const Theme = ({ formats, Story, context, colourScheme }: ThemeProps) => (
255+
const Theme = ({
256+
formats,
257+
Story,
258+
context,
259+
colourScheme,
260+
hideFormatHeading = false,
261+
}: ThemeProps) => (
246262
<div
247263
css={{
248264
color:
@@ -258,7 +274,12 @@ const Theme = ({ formats, Story, context, colourScheme }: ThemeProps) => (
258274
<ThemeHeading colourScheme={colourScheme} />
259275
{formats.map((format) => (
260276
<>
261-
<FormatHeading format={format} colourScheme={colourScheme} />
277+
{!hideFormatHeading && (
278+
<FormatHeading
279+
format={format}
280+
colourScheme={colourScheme}
281+
/>
282+
)}
262283
<Palette
263284
colourScheme={colourScheme}
264285
context={context}
@@ -302,7 +323,10 @@ const Theme = ({ formats, Story, context, colourScheme }: ThemeProps) => (
302323
export const splitTheme =
303324
(
304325
formats: ArticleFormat[] = [...defaultFormats],
305-
{ orientation = 'horizontal' }: Orientation = {},
326+
{
327+
orientation = 'horizontal',
328+
hideFormatHeading = false,
329+
}: SplitThemeOptions = {},
306330
): Decorator =>
307331
(Story, context) => (
308332
<div
@@ -318,12 +342,14 @@ export const splitTheme =
318342
formats={formats}
319343
Story={Story}
320344
context={context}
345+
hideFormatHeading={hideFormatHeading}
321346
/>
322347
<Theme
323348
colourScheme="dark"
324349
formats={formats}
325350
Story={Story}
326351
context={context}
352+
hideFormatHeading={hideFormatHeading}
327353
/>
328354
</div>
329355
);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# AMP Removal
2+
3+
## Context
4+
5+
Google AMP is an open-source, website-publishing technology that enables you to create a website that loads almost instantly on mobile devices. AMP stands for “accelerated mobile pages.” Google created AMP so that publishers and businesses could avoid slow-loading web pages that frustrate users.
6+
7+
The pages loaded more quickly for users on constrained devices, and Google’s search algorithm had a requirement that stories that appeared in the top stories carousel would have to be amp pages.
8+
9+
In June 2021 an update to Google's Top Stories algorithm meant AMP was no longer needed to appear in top stories. In November 2021 Twitter phased out support for AMP.
10+
11+
### Negatives
12+
13+
- Issues with maintaining and updating AMP as a separate platform from a technical perspective
14+
15+
- User experience impact of sign in & cookies for AMP
16+
17+
- Design opportunities are limited on AMP
18+
19+
- The website accessibility and performance improvements we make only affect web/apps
20+
21+
- Better user experience editorially to land on a Guardian page than an AMP page when coming via Google
22+
23+
- For contributions AMP is the worst performing platform between Apple News, Web and AMP
24+
25+
More details in [Guardian and AMP](https://docs.google.com/document/d/1LLv_KFP5WVPis7KtWhJQNwZwWyJ_JuH2bDNxkAUymIU/edit?tab=t.0)
26+
27+
## Decision
28+
29+
We switched off AMP for a trial period between 12th August 2024 to 9th September 2024
30+
31+
Following analysis of the trial period we switched off AMP completely on 7th January 2025.
32+
33+
AMP code can now be deleted.
34+
35+
More details in the [chat channel](https://mail.google.com/chat/u/0/#chat/space/AAAA5AQB80w)
36+
37+
## Status
38+
39+
Approved

dotcom-rendering/docs/architecture/amp/000-structure-for-initial-milestone.md renamed to dotcom-rendering/docs/architecture/historic-adrs/000-structure-for-initial-milestone-amp.md

File renamed without changes.

dotcom-rendering/docs/contributing/where-should-my-code-live.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ In DCR, we use file suffixes to help provide some context & information around f
2222

2323
**Rendering Target**
2424

25-
DCR supports rendering for different targets - web, apps & amp.
25+
DCR supports rendering for different targets - web & apps.
2626
To mark code which is only to be used for specific rendering target, this should be added to the suffix of the file, e.g `MyComponent.apps.tsx`, `MyLib.amp.ts` or `MyLayout.web.tsx`.
2727

2828
These files all still live in the directories, and the suffixes are used to determine which target that code is for.
2929
In the case that there's no suffix, it can generally be assumed this code can be shared across targets.
3030

3131
> Note: When this was set up, most web code stayed without suffixes, which means there's a chance it's not compatible with other targets, so be vigilant when using shared code on a new target for the first time.
3232
33-
> Note: Some un-suffixed code might be shared across apps & web, but not AMP, or some other combination, so keep an eye out to see if there's a platform specific version of the file you're working on!
33+
> Note: Some un-suffixed code might be shared across apps & web or some other combination, so keep an eye out to see if there's a platform specific version of the file you're working on!
3434
3535
**Islands / Client side (P)react**
3636

dotcom-rendering/docs/elements/Disclaimer.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,3 @@ This is represented in frontend by [DisclaimerBlockElement](https://github.com/g
1616
## CAPI HTML Output
1717

1818
This is inserted raw into the document.
19-
20-
## AMP Cleaned HTML
21-
22-
This is run through the BodyCleaner and the AMP cleaners.

dotcom-rendering/docs/elements/Embed.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,4 @@ Appears raw.
2727

2828
If an embed uses `<figure>` tag, then the `ShowAllArticleEmbedsSwitch` can be used with `InBodyElementCleaner` to render a reduced subset of embeds.
2929

30-
## AMP Cleaned HTML
31-
32-
The html included in a potential embed may not be permitted by the AMP specification. For each embed that is renedered in an article we can:
33-
34-
- Transform the embed into something which is valid amp.
35-
- Remove the embed.
36-
- Fail to render the article in AMP.
37-
38-
The field `isMandatory` should control whether an embed is removed or if the page is. Dotcom does not currently support this API, so currently a workaround is used by central production to force the page to fail amp validation.
39-
4030
## Salient Points

dotcom-rendering/docs/elements/Image.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,6 @@ This is run through the [PictureCleaner](https://github.com/guardian/frontend/bl
208208
- Uses [WidthsByBreakpoint](https://github.com/guardian/frontend/blob/91e117429d865936692de60aa2bea6740bde4f75/common/app/layout/WidthsByBreakpoint.scala#L1) to generate a list of _image_ breakpoints to combine with the media into urls.
209209
- Combines the **master** ImageAsset and [breakpoints](https://github.com/guardian/frontend/blob/a101940926699230b8a95a9082aa56327ca98988/common/app/views/support/Profile.scala#L17) to generate [srcset](https://github.com/guardian/frontend/blob/a101940926699230b8a95a9082aa56327ca98988/common/app/views/support/Profile.scala#L240)s.
210210

211-
## AMP Cleaned HTML
212-
213-
This is run through the same cleaners and templates up to `image.scala.html` where it is then rendered using [ampImage](https://github.com/guardian/frontend/blob/f16a4ac50492dc65d7274576840c6993165a2485/common/app/views/fragments/amp/ampImage.scala.html) which uses [getAmpImageUrl](https://github.com/guardian/frontend/blob/a101940926699230b8a95a9082aa56327ca98988/common/app/views/support/Profile.scala#L298) to get a 620px wide crop.
214-
215211
## Salient points
216212

217213
- Image URLS need to be rewritten from `media.guim` to `i.guim` on the server.

dotcom-rendering/docs/elements/Instagram.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,3 @@ This is represented in frontend by [InstagramBlockElement](https://github.com/gu
1313
## CAPI HTML Output
1414

1515
Absolute tonnes of it wow.
16-
17-
## AMP Cleaned HTML
18-
19-
An amp tag [`<amp-instagram>`](https://www.ampproject.org/docs/reference/components/amp-instagram) exists to represent this content.
20-
21-
It requires the following data:
22-
23-
`data-shortcode` | the URL slug for the embed
24-
`data-captioned` | whether a caption is displayed
25-
`width` | the width of the image (not the whole embed)
26-
`height` | the height of the image (not the whole embed)

dotcom-rendering/docs/elements/Text.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,3 @@ The [BlockNumberCleaner](https://github.com/guardian/frontend/blob/bb83dabb21aea
4242
- Something else about quotes.
4343
- AffiliateLinksCleaner
4444
- Rewrites URLs on applicable links and adds a disclaimer.
45-
- AttributeCleaner("style")
46-
- Removes inline style on amp articles. Inline style could be in a text block, but it's unlikely.
47-
48-
## AMP Cleaned HTML
49-
50-
This is run through the BodyCleaner and the AMP cleaners.

dotcom-rendering/docs/elements/Tweet.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ These are dynamically enhanced on the client side by loading the twitter javascr
2020

2121
## Article Cleaned HTML
2222

23-
## AMP Cleaned HTML
24-
2523
## Salient Points
2624

2725
We store enough in CAPI to handle deleted tweets and displaying their images without the twitter js enhancement.

0 commit comments

Comments
 (0)