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

create a partial guidance #4465

Merged
merged 4 commits into from
Jan 8, 2025
Merged
Changes from 2 commits
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
26 changes: 26 additions & 0 deletions docs/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -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](#creating-a-partial)
* [Details expander for non-UK content](#details-expander-for-non-uk-content)
* [YouTube Video](#youtube-video)
* [Hero](#hero)
Expand Down Expand Up @@ -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 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 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
<div class="check-qualifcations">
<h3>Check your qualifications</h3>
<p>To train to teach <%= @front_matter["subject"] %> in England, you'll need:</p>
<ul>
<li>GCSEs at grade 4 (C) or above in English and maths (and science if you want to teach primary)</li>
<li>a bachelor's degree in any subject</li>
</ul>
<p>Having relevant A levels can show your subject knowledge, if you do not have a degree in <%= @front_matter["subject"] %>.</p>
</div>

```
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' %>
```




### Adviser (CTA) component
Expand Down
Loading