Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata block #4392

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/views/landing_page/blocks/_metadata.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%
page_title = @content_item.title
page_title = block.data["title"] if block.data["title"]

page_description = @content_item.description
page_description = block.data["description"] if block.data["description"]

featured_image = image_path(block.data["featured_image"])

url = "https://www.gov.uk" + @content_item.base_path
%>
<% content_for :extra_headers do %>
<meta name="description" content="<%= page_description %>" />
<meta property="og:title" content="<%= page_title %>">
<meta property="og:description" content="<%= page_description %>">
<meta property="og:url" content="<%= url %>">
<meta property="og:image" content="<%= featured_image %>">
<meta property="og:site_name" content="GOV.UK">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image:alt" content="<%= block.data["featured_image_alt"] %>">
<% end %>
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/be_kinder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/be_thankful.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/donate_to_charity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/exercise_more.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/goals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/homepage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/learn_something_new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down
5 changes: 5 additions & 0 deletions lib/data/landing_page_content_items/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ navigation_groups:
- text: Be thankful
href: "/landing-page/be-thankful"
blocks:
- type: metadata
featured_image: landing_page/placeholder/desktop.png
featured_image_alt: a grey placeholder image
title: "Add title here to override Whitehall"
description: "Add description here to override Whitehall"
- type: main_navigation
navigation_group_id: Top Menu
- type: hero
Expand Down