This is a base template for displaying single news articles for use in various ENP research experiments. You can see an example of the page at https://thenewsbeat.org/trust-indicators/articles/us-demographic-shift-will-have-huge-political-impact/
config.php is where most of the work will happen. A few constants get set there that are the basis for the study. What variation of the study you get is based on query parameters in the URL, like /?author_photo=personal&author_bio=basic. Then constants get set based on those parameters. Use the root / as the control for the study.
The templating structure is manual, but simple. To create a new article, copy and paste one of the existing articles in the /articles/
directory then rename it to the name of your article, such as /my-new-article/
.
Then, replace the content in /articles/my-new-article/data.php
. The variables set in data.php will get passed to the template files. data.php
basically serves as a way to avoid setting up an actual database for each new experiment since the project is small. If you were to use this system to build an actual CMS, you'd want to use a database.
Comments just log to a file via Javascript, not a database. They're only submitted via AJAX through /assets/js/post-with-comments.js
.
All clicks on buttons or links are tracked via Google Analytics and pass the button or link identifier, as well as which article the click came from.
We're using Gulp to compile. Run npm install
from your project directory to install the node modules from package.json
. Run gulp
on the command line to serve the project up via localhost with BrowserSync.
Make sure to update the article-list.html file with links to all of your articles