Adding News Articles to the HEP Group Website
There are two main ways to add news articles to the HEP group website:
- Adding a news item to the Physics Dept. News & Events feed;
- Creating a
.news-public
file in the/unix/www/html/news/
directory.
Instructions for both methods are given below.
Adding to the Physics Dept. News & Events news feed
To add news items to the Departmental news feed, each news item needs to be submitted through the Drupal CMS interface. This can only be carried out by someone with the required Departmental website editing permissions: at present this includes Bonita Carboo and Shanice Thomas.
To add an article, the following information is required:
- Title (100 characters max)
- This will serve as the link from the news feed, page h1 header and URL.
- A Featured Image (scalable to 767px width by 480px height)
- This will serve as the icon image in the news feed and the page image on the news item.
- A Date
- This can be future or past dated and the order of news items in the feed will be chronological. It is recommended to use the date the article is submitted.
- Content intro/summary (280 characters max)
- This should summarise the news item and serve as an abstract it will display in the news feed, on the news item in a grey box underneath the title and serve as your google metadata.
- Article Content
- Approximately 200 words is recommended as a good starting point for news content. This can contain links to other pages.
- Article Tags and Subjects
- As a minimum, the article should be associated with the Subject “High energy physics” so that it appears when searching for news specific to HEP. In addition, the article can be tagged to appear in other research group, departmental or faculty news feeds.
Once the news article is listed on the departmental news page, there is an automatic script,
uclnewssearch.sh
, that will pull this news content from the departmental news feed
and create a news snippet on the HEP web server pointing to the main article.
This is in the form of a dated *.news-public
file.
Speaking of which...
Adding items directly to the HEP web server
If you don't want the news article to appear in the Departmental news feed,
articles can be added directly to the news
directory on the
HEP web server: this can be found at /unix/www/html/news/
on plus1
.
The filename needs to begin with the full 8-digit date for the news article,
followed by a few words of descriptive text before the extension, so
20220303_ExampleNewsArticle.news-public
.
The date at the start — in YearMonthDay format — is important
since its how the PHP news script that collates articles orders them correctly.
Once created, the article then needs to be moved into the subdirectory in
/unix/www/html/news/
corresponding to the correct date.
Each news article is just a text file containing a snippet of HTML and with
the extension .news-public
or .news
:
use the extension .news-public
if you want the article to appear
in the news feed on the group public homepage,
or .news
if it just contains information for the group;
this will then appear on the group local homepage.
At a bare minimum, the snippet should be enclosed in opening
<article class="news">
and closing
</article>
tags.
To replicate the structure of central UCL news articles, the full article HTML structure is as follows:
<article class="news">
<div class="feed__image">
<a href="https://link.to.main.article/">
<img typeof="foaf:Image" src="https://link.to.image.url/>
</a>
</div>
<div class="feed__text-content">
<h3>
<a href="https://link.to.main.article">
Main Article Title
</a>
</h3>
<p>
Main article snippet text.
<br>
<time>Date of article</time></p>
</div>
</article>
To make the process of writing article files considerably easier, a script
has been written — scripts/writeNewsArticle.sh
—
that automates the creation of a .news-public
file.
This takes as input a text file containing definitions for each of the
required fields and generates the HTML snippet with the correct filename.
An example input file, articleTemplate.txt
, can be duplicated
in order to speed up the creation of news articles.
This has the following content:
#!/bin/bash # Date of article in YEAR-MONTH-DAY format YYYY-MM-DD declare -a DATE=("2022-03-03") # Article title - optional declare -a TITLE=("Mini particle accelerator a step closer to being realised") # Article image URL - optional declare -a IMAGE=("https://www.ucl.ac.uk/news/sites/news/files/styles/ large_image/public/plasmacellscropped.jpg?itok=oTDAKP3r") # Link to main article - optional declare -a LINK=("https://www.ucl.ac.uk/news/2022/mar/ mini-particle-accelerator-step-closer-being-realised") # Main article text declare -a ARTICLE=( "Mini particle accelerators are a step closer to being realised after a new study co-led by UCL researchers showed it would be possible to accelerate millions of bunches of electrons per second using plasma waves." )
This content can be copied into your own text file, articleText.txt
(or whatever name you choose) in order to write your own news article.
The .news-public
file can then be generated by calling:
/unix/www/html/news/scripts/writeNewsArticle.sh -v articleText.txt
The file articleText.txt
can be in any directory
— the script will move it into the correct one —
with the correct field definitions given in the example above.