Skip to content

A collection of fortune cookies brought to the Web. Refresh the page for new quotes.

Notifications You must be signed in to change notification settings

your-fortune/your-fortune.github.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Your Fortune logo

Bringing the Unix fortune command to the web.


Introduction

This project began as a server-side PHP script, and morphed into a client-side javascript application. Each page reload presents a new quote. Read the full story on our About page.

Roadmap

  • Ongoing: Add additional fortune sources.
  • Build on GitHub pages
  • Add a Jekyll page for each fortune datasource.
  • Add site navigation.
  • Support dark mode.
  • Poorman's API: expose public fortune files as JSON.
  • Support multiple sources on a single page.
  • Support remote JSON.
  • Create a reusable Jekyll theme, move styles/scripts to a separate repository.
  • Move site to a custom domain.
  • Support JSONP from remote APIs.
  • Add a brutalist design, as an alternative of the minimalist design.
  • Automate the conversion of fortune data files into JSON files.
  • Image file & meme generator.
  • Add Facebook Open Graph, Instagram, Twitter Card integration.
  • Implement an API to return a single random fortune.
    • This probably means moving off of static GitHub Pages.

Contributing

You can contribute to site improvements (see GitHub pages and Jekyll documentation).

You may also contribute data sets. Each contribution should contain:

  • A JSON-formatted dataset file containing quotes. The file should be placed inside data/, and named to something relevant, ensure your JSON file passes JSONlint validation, and is formatted with one quote per line.

    The formatting rules are roughly as follows:

    {"data":[
    {"quote":"First quote", "author": "Someone"},
    {"quote":"Second quote", "author": "Someone else"},
    {"quote":"Author is optional"},
    {"quote":"Text may have *emphasis* (italics) or **strong emphasis** (bold), but please use sparingly."},
    {"quote":"Avoid \"straight quotes\", in favor of “curly quotes” when possible."},
    {"quote":"Prefer double-curly quotes and only use single curly quotes “when ‘quoting inside’ a quote.”"},
    {"quote":"Don't use the straight apostrophe in punctuation! ’Twil be the death of you.”"},
    {"quote":"Don’t use <em>html markup</em>"},
    {"quote":"Single newline characters like this-->\n are converted into <br> tags."},
    {"quote":"Double newline characters like this-->\n\n break the text into separate paragraphs with more whitespace."},
    {"quote":"The last quote in the JSON should not have a trailing comma to pass validation"}
    ]}
    
  • A page for rendering the dataset in the website, placed inside _pages/. The following frontmatter is required:

    ---
    layout: quote
    permalink: /example
    title: Example Quotes
    description:  A selection of example fortunes.
    dataset: data/example.json
    ---
    

    Multiple datasets can be provided as follows:

    dataset:
      - data/example1.json
      - data/example2.json
    

    Remote datasets can be loaded as well, as long as the origin has a wildcard CORS header in the responses. Referencing JSON files from files hosted with GitHub Page and/or Raw GitHub (raw.githubusercontent.com) both work.

    dataset:
      - https://your-fortune.github.io/data/example.json
      - https://raw.githubusercontent.com/your-fortune/your-fortune.github.io/master/data/example.json
    

    Additionally, you may provide style: example.css to load a custom stylesheet placed in assets/css/example.scss containing special webfont or font-size declarations. (Ex. steven-wright.scss). Note: the SCSS file must start with an empty frontmatter section in order to be processed into CSS.

  • an entry in _data/navigation.yml to the page's permalink.

Getting up and running locally

  1. Install the ruby and the bundler gem.

  2. Fork this repository, then clone it to your machine.

  3. Run bundle install.

  4. Run bundle exec jekyll serve, then navigate to http://127.0.0.1:4000 in your Web browser.

  5. Make changes, review in browser, commit them, and contribute pull requests.

Support or Bugs

File an issue