Web Design

15 January 2020 — Written by Avery

This is Gatsby

And it's going to help me push new content easier.

It's not really as easy as my WordPress site, but it's definitely several elephants lighter.

It's a complete website framework based on react.js toolkit to render pages. React.js is developed by Facebook, and it's taking the web by storm.

I'm basically working with both so I can get hands-on experience developing for WordPress and React.js, which collectively make up a disporportionate amount of sites hosted on the web (WordPress alone accounts for about 25% of all websites).

My old page was written with PHP tags for dynamic content (dates, page names, active buttons, etc.), Twitter Bootstrap for responsive CSS styling and components, and good ol' HTML - which collectively make up the new "HTML5" spec, apparently.

If you want to see my old bootstrap website I built from the ground-up, click this link

But if you want a streamlined content delivery system, check out Gatsby or Wordpress, using this Gatsby site or my wordpress site develmonk.com as an example

Stuff like blockquotes are all super easy.

Render Codeblocks with Syntax Highlighting

The PrismJS plugin allows codeblocks to render highlighted according to syntax. For instance, this is what this page looks like in a standard text editor:

## This is Gatsby

It's a complete website framework based on react.js(https://reactjs.org/)
toolkit to render pages. React.js is developed by Facebook
(https://developers.facebook.com/docs/react-native/), and it's 
taking the web by storm.

> Stuff like blockquotes are all super easy.

## This will be a heading


Here's how tables are written:

| Tables        |      Are      |   Cool |
| ------------- | :-----------: | -----: |
| col 3 is      | right-aligned | \$1600 |
| col 2 is      |   centered    |   \$12 |
| zebra stripes |   are neat    |    \$1 |

And here's how tables are rendered:

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

Here's an example of css highlighting:

/* PostCSS code by PrismJS */

pre {
  background: #1a1a1d;
  padding: 20px;
  border-radius: 8px;
  font-size: 1rem;
  overflow: auto;

  @media (--phone) {
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  code {
    background: none !important;
    color: #ccc;
    padding: 0;
    font-size: inherit;

    .dark-theme & {
      color: inherit;
    }
  }
}

Here's some JavaScript ES6 (what the Gatsby static generator is based upon):

// JS code by PrismJS

const menuTrigger = document.querySelector('.menu-trigger')
const menu = document.querySelector('.menu')
const mobileQuery = getComputedStyle(document.body).getPropertyValue('--phoneWidth')
const isMobile = () => window.matchMedia(mobileQuery).matches
const isMobileMenu = () => {
  menuTrigger.classList.toggle('hidden', !isMobile())
  menu.classList.toggle('hidden', isMobile())
}

isMobileMenu()

menuTrigger.addEventListener('click', () => menu.classList.toggle('hidden'))

window.addEventListener('resize', isMobileMenu)

And how about some good ol' HTML:

<section id="main">
  <div>
   <h1 id="title">{{ .Title }}</h1>
    {{ range .Pages }}
        {{ .Render "summary"}}
    {{ end }}
  </div>
</section>

Can't forget bash:

$ cat ~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

HISTCONTROL=ignoreboth
shopt -s histappend

bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

shopt -s checkwinsize

[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

~/.bash_aliases, instead of adding them here directly.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# set PATH so it includes user's global yarn bin if it exists
if [ -d "$HOME/.yarn/bin" ] ; then
    PATH="$HOME/.yarn/bin:$PATH"

Use Markdown to Create Posts

Developers like working in text editors, so why open a WYSIWYG for web pages?

Write everything in markdown!

  • Static pages can't really be hacked
  • Super fast load times
  • Easy deployment
  • Host basically anywhere (Amazon S3 free tier, anyone?)

    • Do all sorts of rad stuff w/ React and Node
    • Be super cool and ride the wave of currently popular languages/frameworks

Best of all, embedding silly videos is way too easy.

I'm working on adding a gallery of photos from my field work.

If you want some help with web design, especially help with setting up a content delivery framework like Gatsby or Wordpress, please send me an email