Git Product home page Git Product logo

railroadersleep's Introduction

Railroader Sleep

Table of Contents

Purpose

A sample view for the railroadersleep FRA site.

Why a static site?

The static site allows for a number of benefits:

  • The site can be hosted on any static site hosting service, including your own VM.
  • The site can be edited by anyone with a github account, and the changes can be reviewed and approved by the site owner.
  • The site can be edited using markdown, which is a simple text format that is easy to learn.
  • The site can be edited using a CMS like WordPress, but that would be a lot of work for this project.
  • Performance is better than a CMS like WordPress, because the site is pre-built and served as static files. There are no database calls or server side rendering. The site is also served from a CDN, which is faster than a single server.
  • No database and static files means lower security risk.

Site Technical Requirements

  • The site is built with Astro (https://astro.build/), a static site generator that uses any front end framework. Documents can be managed using .md and .mdx files. Astro can also be linked to a CMS like WordPress, but that would be a lot of work for this project.
  • The site is hosted on Netlify (https://www.netlify.com/), a static site hosting service. Any static site hosting service can be used, including your own VM.
  • The dependencies are managed using pnpm (https://pnpm.io/), a package manager that is similar to npm. You can use npm if you prefer.

Editing articles

Editing the interactives

Look at src/pages/think-fast.astro and src/pages/caffeine-interactive.astro. The bundles necessary to run the interactives are shown in the code, and the code and bundles are in the public folder. You can edit the code in the public folder and the next build will pick up your changes.

The Events Calendar

The events calendar is set up using AirTable as a database, and an email is sent to the owner of the Table when a new event is added. The email contains a link to the AirTable record, and the owner can edit the record to add more information. The calendar is then updated every night once the site is rebuilt on github and deployed to Netlify.

Images

Replace all the image assets that are carried over from the old site. THe resolution is too low for high resolution screens.

Videos

Please let us know when you are ready to download videos from the beta site. We can enable downloads of our vimeo videos for you to download and upload to the new site.

Some research about railroad workers and sleep education

Editing Metadata

Look for the src/config.mjs file. This is where all the metadata such as site name, title, description is stored. You can edit the metadata there and the next build will pick up your changes. See the file src/components/core/MetaTags.astro for how the metadata is used in the site.

Editing the home page

This is a little complicated, but the home page is in src/pages/index.astro. You will see a number of components, that make up the index page. You can

Project structure

/
├── data/
|   └── blog/
|       ├── post-slug-1.md
|       ├── post-slug-2.mdx
|       └── ...
|   └── tours/
|       ├── apnea-introduction.md
|       ├── sleep-introduction.md
|       └── ...
├── public/
│   ├── robots.txt
│   └── favicon.ico
|   └── interactives ...
├── src/
│   ├── assets/
│   │   ├── images/
|   |   └── styles/
|   |       └── base.css
│   ├── components/
│   │   ├── atoms/
│   │   ├── blog/
│   │   ├── core/
|   |   └── widgets/
|   |       ├── Header.astro
|   |       ├── Footer.astro
|   |       └── ...
│   ├── layouts/
│   |   |── BaseLayout.astro
│   |   └── ...
│   ├── pages/
│   |   ├── [...blog]/
|   |   |   ├── [...page].astro
|   |   |   └── [slug].astro
│   |   ├── [...categories]/
|   |   |   └── [category]/
|   |   |       └── [...page].astro
│   |   ├── [...tags]/
|   |   |   └── [tag]/
|   |   |       └── [...page].astro
│   |   ├── index.astro
|   |   ├── 404.astro
│   ├── utils/
│   └── config.mjs
├── package.json
└── ...

Any static assets, like images, can be placed in the public/ directory if they do not require any transformation or in the assets/ directory if they are imported directly.


Commands

All commands are run from the root of the project, from a terminal:

Command Action
pnpm install Installs dependencies
pnpm run dev Starts local dev server at localhost:3000
pnpm run build Build your production site to ./dist/
pnpm run preview Preview your build locally, before deploying

Configuration

Basic configuration file: ./src/config.mjs, edit it to change the site name, origin, etc.


Testing

Playwright

Install using pnpm dlx create-playwright

pnpm dlx playwright test Runs the end-to-end tests.

pnpm dlx playwright test --project=chromium Runs the tests only on Desktop Chrome.

pnpm dlx playwright test example Runs the tests in a specific file.

pnpm dlx playwright test --debug Runs the tests in debug mode.

pnpm dlx playwright codegen Auto generate tests with Codegen.

Review the report usingpnpm dlx playwright show-report

We suggest that you begin by typing:

pnpm dlx playwright test

And check out the following files:

  • ./tests/example.spec.ts - Example end-to-end test
  • ./tests-examples/demo-todo-app.spec.ts - Demo Todo App end-to-end tests
  • ./playwright.config.ts - Playwright Test configuration

Visit https://playwright.dev/docs/intro for more information. ✨

Deploy

Automatically deploys to Netlify on push to main branch. Go to https://app.netlify.com/sites/railroadersleep/overview to see the status of the deploy.

Deploy to production (manual)

You can create an optimized production build with:

pnpm run build

Now, your website is ready to be deployed. All generated files are located at dist folder, which you can deploy the folder to any hosting service you prefer.


Acknowledgements

Modified from AstroWind, initially created by onWidget and maintained by a community of contributors.

cleaning github diffs for pdf export

document.querySelector("#repository-container-header").hidden = true
document.querySelector(".Subhead").hidden = true
document.querySelector(".position-relative, .js-header-wrapper").hidden = true
document.querySelector("#all_commit_comments").hidden = true
document.querySelector(".commit, .full-commit").hidden = true

document.querySelector(".Layout-sidebar, .overflow-y-auto, .hx_Layout--sidebar, .js-notification-shelf-offset-top").hidden = true

document.querySelector("div.thread-subscription-status").hidden = true

railroadersleep's People

Contributors

tayhimself avatar lkbarger avatar mdw-work avatar brandoncoplen avatar sleepdoctucson avatar

Stargazers

 avatar  avatar

Watchers

 avatar

railroadersleep's Issues

Add a Previous Page button

  • create a new Astro component that is a styled, centered, button.
  • use window.history.back() to go to the previous page
  • add the component to the core folder.
  • use the component in the singlepost.astro component.

SEO content

All SEO content will go here.

The lighthouse scores for the current FRA railroaders site is great. Clearly that's not a problem though we should set up a best practices here as well just so that the FRA doesn't neglect this aspect during their development.

For direction use these links plus other stuff on hubspot.
https://developers.google.com/search/docs/fundamentals/seo-starter-guide
https://blog.hubspot.com/blog/tabid/6307/bid/235/no-website-is-an-island-why-and-how-to-link-to-others.aspx

For an Astro SEO implementation https://github.com/jonasmerlin/astro-seo

Update blog file names

Blog File names are too long

  • Update the file names to be shorter and more efficient

Railroadersleep>data>blog

Add categories to nav bar

Add correct categories to nav bar. Currently, we have an incorrectly named category "Explore Sleep" which should be named "How Sleep Works" and we have 2 separate links for categories in the nav bar.

Add a programmatically populated dropdown to the nav bar listing each category and linking to a page with all articles from that category. Remove the manually generated category pages for Explore Sleep and Body Clock.

Update video quality

The current videos are stored at a low quality

  • Update the videos so that they are a higher quality

Explore alternative carousels

Create a new Carousel component Carousel2

There are a lot of ways to create a carousel. I don't really know the right way, but it would be a fun and educational exercise to try out a couple of different options. Let's explore some further before deciding on one. I'd appreciate it if you could implement one or more of the choices below.

Inspiration for a nicer slider component is https://media.hopper.com

  1. An alternative library
  1. Using an animation library with svg elements for controls. This is probably going to be the hardest to implement.
  1. CSS focused ones

Let me know in the thread what you think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.