• Stars
    star
    446
  • Rank 97,888 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Create static timeline webpages.

Static timeline generator

Easily create a static timeline webpage like my Wikimedia timeline. Check out a preview of this sample site, deployed with GitHub Pages: https://molly.github.io/static-timeline-generator/.

Contents

Screenshot of a timeline page with dummy content

Install

Clone this repository, then run npm install from the directory.

npm run-script serve will build the project and serve the static files locally at http://localhost:8080. npm run-script build just runs the build step without starting the development server.

Customize

Almost all of the content you need to change is in src/_data/content.js.

Primary content

  • header (HTML, optional): The content to display in the header at the top of the page.
  • footer (HTML, optional): The content to display in the footer at the bottom of the page.
  • entries (array of objects, required): The list of entries to display on the timeline, in the order they should display.
    • id (string, required): A unique ID for this timeline entry.
    • categories (array of strings, optional): A list of categories that apply to this entry. These will show up as checkboxes at the top of the page, and allow readers to filter the timeline. They may not contain commas. They can be hyphen or space separated (sample category or sample-category will both display on the page as Sample category). Entries without any categories will always display.
    • color (string, optional): The color of the circle that displays on the timeline line. The options already defined are green, red, and grey. You can define additional colors in css/custom.css (see below).
    • faicon (string, optional): The name of a Font Awesome icon to use in the circle on the timeline line. Explore the options. This is just the icon name (without the fa- prefix). For example: anchor.
    • datetime (string, either datetime or date must be present): A date and time specifier for the item. This can be in any format that moment.js recognizes. I normally do "YYYY-MM-DD HH-SS". If there is no time, only a date, use the date parameter instead of datetime.
    • date (string, either datetime or date must be present): A date specifier for the item. "YYYY-MM-DD".
    • title (HTML, required): The title of the timeline entry.
    • image (optional): An image to display in the entry
      • src (string, required): A direct URL to the image file to be embedded on the page, or a relative link to an image in this directory (for example img/filename.png).
      • link (string, optional): A hyperlink to the page containing the image, if you'd like people to be able to click it to see a larger version, etc.
      • alt (string, optional): Alt text describing the image.
      • caption (HTML, optional): A caption describing the image.
    • body (HTML, required): The text of the timeline entry. If you want multiple paragraphs, you have to include <p> tags yourself; otherwise, it will be added.
    • links (array of objects, optional): An array of links to display at the bottom of the entry.
      • href (string, required): The target of the link.
      • linkText (HTML, required): Link text.
      • extra (HTML, optional): Extra HTML to display at the end of the link.

Meta

  • pageTitle (string, required): The text to go in the <title> tag, to set the title of the page in the browser.
  • pageDescription (string, optional): Page description to go into meta tags.
  • pageAuthor (string, optinal): Page author to go into meta tags.

Additional customization

If you would like to add more color options for the circles on the timeline, you can edit the src/css/custom.css file to add your own. You can use this tool to pick colors and get their hex color codes. They are defined like so:

.timeline-icon.yourcolorhere {
  background-color: #hexcolorcode;
}

You would then use color: yourcolorhere in the content.js file.

Replace the images in the src/img folder to customize the page favicon and OpenGraph image.

Deploy

Once you run npm run-script buld, you will see a _site directory containing static HTML/CSS/JS files with your site content. You can now use any static site hosting to deploy these files!

GitHub pages

To deploy your static site on GitHub pages (free), create a branch containing the static files in the root directory by running git subtree push --prefix _site origin gh-pages. Then you can go to your repository's Settings > Pages options and choose "Deploy from a branch", then select gh-pages as the branch.

Github Pages config settings. Under 'Build and deployment', Source is set to 'Deploy from a branch', branch is set to 'gh-pages', and the folder is set to '/ (root)'.

Other services

There are some good tutorials out there for deploying a static site on various other free services. A few are listed below.

You can also look for tutorials on how to deploy a site built with eleventy, since that's what's powering this project. Some webhosting services like Vercel specifically support eleventy in some really handy ways.

  • Netlify
  • Vercel
  • Render
    • Create a new Static Site on Render
    • Set "build command" to npm run-script build
    • Set "publish directory" to _site

Responsiveness

Timelines will render well on tablets:

Screenshot rendered on a tablet device

or mobile devices:

Screenshot rendered on a phone

Browser compatibility

This should work well on all modern browsers. IE <9 is not supported.

Without JavaScript enabled, the page degrades gracefully. However, posts will show in a single-column timeline and filters will not show.

Under the hood

This project uses

It is released under the MIT license.

More Repositories

1

web3-is-going-great

A timeline of some of the greatest hits in cryptocurrencies, NFTs, and other web3 projects since the beginning of 2021
JavaScript
783
star
2

annotate

Annotate text and publish it on the web
HTML
289
star
3

gh-dork

Github dorking tool
Python
136
star
4

manager-README

A crash course on what to expect if I'm your tech lead
123
star
5

twitterbot_framework

A very basic framework for creating Twitter bots.
Python
57
star
6

dynamic-website

Small app to power the dynamic portions of my website.
JavaScript
51
star
7

wikimedia-timeline

A timeline of events surrounding the Wikimedia Discovery project, senior leadership, staff departures, and other unrest at the Wikimedia Foundation from 2014–2016.
HTML
46
star
8

CyberPrefixer

Twitter bot to prefix "cyber" to news headlines
Python
43
star
9

w3igg-crossposter

Automate crossposting web3isgoinggreat.com posts to social media
Python
40
star
10

SOFT-HRUF

SOFT/HRUF free and open source steno hardware
37
star
11

GorillaBot

IRC bot framework written in Python.
Python
30
star
12

follow-the-crypto

Follow the cryptocurrency industry’s influence on 2024 elections in the United States.
TypeScript
28
star
13

courtlistener-download

Chrome extension to download all files related to one docket entry on CourtListener
JavaScript
23
star
14

website-v2

v2 of my personal website
Pug
20
star
15

blog

SCSS
17
star
16

follow-the-crypto-backend

Python
16
star
17

allmybotsgone

Python
16
star
18

misheardly

Twitter bot to mishear song lyrics
Python
13
star
19

ftx-contagion

Chart of the FTX contagion
12
star
20

yourevalued

Twitter bot to tell people they're valued.
Python
12
star
21

reading-list-extension

Chrome extension to add items to my reading lists
JavaScript
11
star
22

SubstitutionBot

Twitter bot to make funny news headlines a la http://xkcd.com/1288/.
Python
9
star
23

paywall-bot

A Bluesky bot to help people find unpaywalled resources.
Python
9
star
24

Wikisource-to-LaTeX

A Python project that traverses through a Wikisource project and compiles it into a LaTeX book.
Python
7
star
25

nft-theft-analysis

Python
6
star
26

easyreader

Custom JS/CSS to make Wikipedia pages more comfortable to read
CSS
6
star
27

snowbot

A Twitter bot that tells you the forecast for Boston, but more importantly tells you when that forecast changes.
Python
6
star
28

citation-needed-scripts

Scripts for CitationNeeded.news
JavaScript
6
star
29

absolute-dates

Chrome extension to show absolute dates where only relative dates are displayed
JavaScript
5
star
30

mass-shooting-map

Generate a map template of mass shootings in the United States for usage on Wikipedia.
Python
4
star
31

newsletter

HTML
3
star
32

wikipedia-covid-ma

Scripts to help update the Wikipedia article on the COVID pandemic in Massachusetts.
Python
3
star
33

delete-tweets

Script to delete tweets older than a specified date
Python
2
star
34

website

Code for my current website
HTML
2
star
35

citation-needed-backend

Small webhook server to augment a self-hosted Ghost site at CitationNeeded.news
JavaScript
2
star
36

ghost-patches

Patches to the Ghost core software, used for the Citation Needed newsletter
2
star
37

mbta-ui

Frontend for the MBTA transit app.
JavaScript
1
star
38

bias

JavaScript
1
star
39

audit-cuos

Generate activity reports for functionaries on the English Wikipedia.
Python
1
star
40

website-v3

v3 of my personal website
Nunjucks
1
star
41

convert-gmail-timestamp

Convert GMail timestamps to ISO 8601 timestamps
Python
1
star
42

brandeis

Parser to convert Mark Holmquist's lochner files to wikitext.
Python
1
star