tatticoder / home

The Console website.

Home Page:https://console.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Console website

Generated using Hugo and deployed to Cloudflare Workers Sites.

Links

Site development setup

For any site development that doesn't require modifying Cloudflare Workers code, you only need Hugo:

  1. Install Hugo.
  2. Two options:
    • Run ./dev.sh to start the Hugo server on localhost.
    • Run ./dev.sh xxx.xxx.xxx.xxx to test from other devices on local network (such as iPhone), where xxx.xxx.xxx.xxx is the local IP of the machine running the Hugo server.
  3. Launch the URL in your browser. It will watch for changes and auto refresh the browser.

Trunk & linting

We use Trunk to handle linting across all files. This runs in CI but you can install it as a Git hook:

cat >>.git/hooks/pre-push <<EOF
# This is required to accept user input from the keyboard.
exec < /dev/tty
trunk check --trigger=git-push
EOF
chmod +x .git/hooks/pre-push

Image specs

Interviews

Profile Pic

  • .jpg
  • 1600x1600px
  • 300kb max
  • Centered subject, square ratio (if possible)

Logo

  • .svg, .png, .jpg
  • 1600x1600px
  • 300kb max

Text (what)

  • 70 characters max

Hugo options

Frontmatter variables

  • headerType: fixed or false - When fixed the header will show on top on scroll.
  • hideLines: true or false - Hides the finer lines from the page.
  • hidePlanes: true or false - Hides the planes grid from the page.
  • isPage: a string defining the page fragment used for the body css class, custom stylesheet definition, menu item activation and assets location.
  • isSubpage: a string defining the subpage fragment used for the body css class, custom stylesheet definition, menu item activation and assets location.
  • customStyle: true or false - Will expect and load a custom style based on the isPage string.
  • pageType: feature, article, vendor-review, see css/pageType/ ... - Defines a custom class for the <body> and <main> page elements.
  • customPageStyle: true or false - Will expect and load a custom stylesheet based on the pageType string.
  • xlViewport: segment for specifying style classes for xl viewports.
    • largeText: true or false will enable text size increase on xl viewports.

Custom Hugo Shortcodes

There are several custom Hugo shortcodes that can be used in templates:

Shortcode Example
Link {{< a-link url="consoledotdev" text="see what we're building" icon-left="github" icon-right="github" >}}
Button {{< a-button url="/about/" text="About" title="View About page" is-text="true" size="null (large)||medium||small" icon-left="arrow-right" icon-right="arrow-right" >}}
Caption Div {{< div-caption >}}Markdown formatted text to appear in the caption.{{< /div-caption >}}
Centered Image {{< img-center src="/img/interviews/stackhawk-scott-gerlach-product.png" alt="StackHawk product screenshot" width="100%" caption="The StackHawk vulnerability scanning dashboard." >}} (Caption optional)
2-column Image {{< img-2col src1="/img/david.jpg" alt1="David Mytton" src2="/img/max.jpg" alt2="Max Jennings">}}
Subscribe Box {{< section-subscribe> }}
Image Modal {{< modal-custom type="screen" type-screen="/img/browser-testing/browserstack-webtesting.png" >}}{{< img-custom class="content-image" src="/img/browser-testing/browserstack-webtesting.png" alt="Screenshot of web testing with BrowserStack." >}}{{< a--close >}}

Parsing tools JSON for /latest/

Set up a Python venv:

python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt

For production builds, the JSON source is retrieved using the gsheet.action GitHub Action. In development, example JSON files are provided in /tests/ and pre-generated examples are already in /themes/console-home/data/.

To generate new examples into /data/:

python parseTools.py --tools-json themes/console-home/data/toolsallraw.json --beta-json themes/console-home/data/betasallraw.json --ignore-date YES

Cloudflare Workers setup

For testing how the site will be served live and/or for development with Cloudflare Workers:

  1. Set up Hugo as described above but have Hugo build the static site rather than using Hugo server: hugo -D
  2. Install Cloudflare Wrangler.
  3. wrangler preview --watch

Live testing

hugo
wrangler publish --env test

Available at: https://test.console.dev

Production

Automatic deployment: run workflow and enter production as the deployment environment.

The Github Action also gets the latest newsletter content and saves the files to the /data/ directory. If no data files exist in that directory, the test files from /themes/console-home/data/ will be used instead.

Performance testing

We use k6 to define performance SLAs. These are run on every commit using GitHub Actions but they can also be run locally after installing k6:

hugo
wrangler publish --env perftest
k6 run tests/perf.js

This tests against https://test.console.dev authenticated using service tokens.

Authentication

Google Service Account

The Google Service Account is used by gsheet.action to pull the contents of the beta programs source Google Sheet. The Google Sheets API is enabled for the Service Account.

Secrets

About

The Console website.

https://console.dev


Languages

Language:HTML 46.6%Language:CSS 40.6%Language:JavaScript 11.2%Language:Shell 0.9%Language:Python 0.6%Language:Dockerfile 0.2%