From 53d021ba4d600ccd7cde72f199c0468b25ba0935 Mon Sep 17 00:00:00 2001 From: joegibb Date: Thu, 2 Jan 2025 14:33:59 +0000 Subject: [PATCH 1/4] create a partial guidance --- docs/content.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/content.md b/docs/content.md index 4382ab2884..faa716c085 100644 --- a/docs/content.md +++ b/docs/content.md @@ -21,6 +21,7 @@ This documentation aims to be a reference for content editors that want to make * [Accessibility](#accessibility) * [iframe](#iframe) * [Inset text](#inset-text) + * [creating a partial](#partial) * [Details expander for non-UK content](#details-expander-for-non-uk-content) * [YouTube Video](#youtube-video) * [Hero](#hero) @@ -334,6 +335,31 @@ If you need to insert an expander into an erb file: link_url: "/non-uk-teachers/non-uk-qualifications", ) %> ``` +### creating a partial + +If the content you are creating will be used elsewhere on the site in the exact same format, it may be a good idea to create a partial. This is a snippet of code that you will be able to call in one line. This saves you have having to write the same things again and again but can also be good for maintenance of the site because you will only have to change anything in one central place. + +To create a partial go to the /app/views/content/shared then either select an appropriate file or create your own category. Then create a file. In the file place the HTML code that you would like to replicate on multiple pages. + +```yaml +
+

Check your qualifications

+

To train to teach <%= @front_matter["subject"] %> in England, you'll need:

+ +

Having relevant A levels can show your subject knowledge, if you do not have a degree in <%= @front_matter["subject"] %>.

+
+ +``` +Then when you want to call your code in another file all you have to do is use the line render <%= render 'content/shared/qualifications-training/check_qualifcations' %> or changing the path for the one you want to link to. + +```yaml + <%= render 'content/shared/qualifications-training/check_qualifcations' %> +``` + + ### Adviser (CTA) component From 778a11e69fcae64804a2acd97fd9dcb5a4d85ae9 Mon Sep 17 00:00:00 2001 From: joegibb Date: Thu, 2 Jan 2025 15:09:01 +0000 Subject: [PATCH 2/4] creating a partial guidance --- docs/content.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/content.md b/docs/content.md index faa716c085..56a69ef95e 100644 --- a/docs/content.md +++ b/docs/content.md @@ -21,7 +21,7 @@ This documentation aims to be a reference for content editors that want to make * [Accessibility](#accessibility) * [iframe](#iframe) * [Inset text](#inset-text) - * [creating a partial](#partial) + * [Creating a partial](#creating-a-partial) * [Details expander for non-UK content](#details-expander-for-non-uk-content) * [YouTube Video](#youtube-video) * [Hero](#hero) @@ -335,11 +335,11 @@ If you need to insert an expander into an erb file: link_url: "/non-uk-teachers/non-uk-qualifications", ) %> ``` -### creating a partial +### Creating a partial -If the content you are creating will be used elsewhere on the site in the exact same format, it may be a good idea to create a partial. This is a snippet of code that you will be able to call in one line. This saves you have having to write the same things again and again but can also be good for maintenance of the site because you will only have to change anything in one central place. +If the content you are creating will be used elsewhere on the site in the exact same format, it may be a good idea to create a partial. This is a snippet of code that you will be able to render in one line. This saves you have having to write the same things again and again. It also means maintenance of the site is easier as any changes you make can be done in one central place rather having to keep track of what information is on what pages. -To create a partial go to the /app/views/content/shared then either select an appropriate file or create your own category. Then create a file. In the file place the HTML code that you would like to replicate on multiple pages. +To create a partial go to the /app/views/content/shared folder then either select an appropriate file or create your own folder. Then create a file. In the file place the HTML code that you would like to replicate on multiple pages. ```yaml
@@ -353,7 +353,7 @@ To create a partial go to the /app/views/content/shared then either select an ap
``` -Then when you want to call your code in another file all you have to do is use the line render <%= render 'content/shared/qualifications-training/check_qualifcations' %> or changing the path for the one you want to link to. +Then, when you are working in another HTML file and want to render your code all you have to do is reference the code you created as follows: ```yaml <%= render 'content/shared/qualifications-training/check_qualifcations' %> From 63f13e291e7b9e0504f32fe28564fe936f6e84bb Mon Sep 17 00:00:00 2001 From: joegibb Date: Mon, 6 Jan 2025 09:28:29 +0000 Subject: [PATCH 3/4] add frontmatter to paritals --- docs/content.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/content.md b/docs/content.md index 56a69ef95e..81cc864a68 100644 --- a/docs/content.md +++ b/docs/content.md @@ -344,20 +344,64 @@ To create a partial go to the /app/views/content/shared folder then either selec ```yaml

Check your qualifications

-

To train to teach <%= @front_matter["subject"] %> in England, you'll need:

+

To train to teach in England, you'll need:

  • GCSEs at grade 4 (C) or above in English and maths (and science if you want to teach primary)
  • a bachelor's degree in any subject
-

Having relevant A levels can show your subject knowledge, if you do not have a degree in <%= @front_matter["subject"] %>.

+

Having relevant A levels can show your subject knowledge, if you do not have a degree in your chosen subject.

``` + Then, when you are working in another HTML file and want to render your code all you have to do is reference the code you created as follows: ```yaml <%= render 'content/shared/qualifications-training/check_qualifcations' %> ``` +If you need a specific change across each version of your code such as the subject, it is possible to create a variable. All you have to do is reference something in the frontmatter. In the following frontmatter the subject is chemistry. + +```yaml +title: Become a chemistry teacher +subject: chemistry +title_paragraph: |- +

+ As a chemistry teacher, you'll spark curiosity and challenge young minds to explore the fundamental principles that govern our world. You'll inspire students to question, experiment, and discover, fuelling their passion for science.

+

+ Tax-free bursaries of $bursaries_postgraduate_chemistry$ or scholarships of $scholarships_chemistry$ are available for eligible trainee chemistry teachers.

+description: |- + Find out how to become a chemistry teacher, including what you'll teach and what funding is available to help you train. +layout: "layouts/minimal" +colour: pastel yellow-yellow +image: "static/images/content/hero-images/chemistry.jpg" +keywords: + - chemistry + - teaching chemistry + - teacher training + +content: + - "content/shared/subject-pages/header" + - "content/life-as-a-teacher/explore-subjects/chemistry/article" +``` + +To create a variable that references the frontmatter simply copy the format below. This will look at the frontmatter, then whatever you reference in the square brackets. In this case, it will look for subject and will render chemistry. This can be changed for anything as long as it is referenced in the frontmatter. +```yaml +<%= @front_matter["subject"] %> +``` +This means that you can use the following code over many pages so that each page has its own unique subject rendered. +```yaml +
+

Check your qualifications

+

To train to teach <%= @front_matter["subject"] %> in England, you'll need:

+
    +
  • GCSEs at grade 4 (C) or above in English and maths (and science if you want to teach primary)
  • +
  • a bachelor's degree in any subject
  • +
+

Having relevant A levels can show your subject knowledge, if you do not have a degree in <%= @front_matter["subject"] %>.

+
+ +``` + From b72a378301be0463a69b58f5b060e9faf477c20f Mon Sep 17 00:00:00 2001 From: joegibb Date: Tue, 7 Jan 2025 13:38:01 +0000 Subject: [PATCH 4/4] Update docs/content.md Co-authored-by: emmaachesongray <168454683+emmaachesongray@users.noreply.github.com> --- docs/content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content.md b/docs/content.md index 81cc864a68..7d0c6e8f84 100644 --- a/docs/content.md +++ b/docs/content.md @@ -388,7 +388,7 @@ To create a variable that references the frontmatter simply copy the format belo ```yaml <%= @front_matter["subject"] %> ``` -This means that you can use the following code over many pages so that each page has its own unique subject rendered. +This means that you can use the following code over many pages so that each page has its own unique subject rendered. ```yaml

Check your qualifications