site/README.md
Lachlan Campbell 3ea9a9befd Begin v3
2020-04-16 16:22:52 -04:00

4.2 KiB
Executable file
Raw Blame History

Hack Club Theme Starter

A sample Next.js project for getting started with MDX, Theme UI, & Hack Club Theme.

Usage

  1. Import this repo to your coding environment of choice. Download it, git clone, or use the GitHub import on Glitch/Repl.it.
  2. yarn to install dependencies.
  3. yarn dev to start your server.
  4. Start adding your own pages & components in their respective directories.

Configuration

Theme switcher

Weve included an example theme switcher component at components/color-switcher.js, which is included on every page through its inclusion in pages/_app.js. Feel free to change it.

Hack Club fonts

If youre making a Hack Club HQ project, youre allowed to use Hack Clubs font, Phantom Sans. To load it, simply uncomment the import '@hackclub/theme/fonts/reg-bold.css' line in _app.js.

Custom theme

By default, the raw Hack Club Theme will be used. If youd like to edit the theme, we recommend making a theme file (perhaps at lib/theme.js) along these lines:

import base from '@hackclub/theme'

const theme = base

// theme.fontSizes = […]
// theme.fonts.heading = ''

export default theme

Running at another port

Super easy: yarn dev -p 5000

Adding meta tags

These template includes @hackclub/meta for adding meta tags to Hack Club HQ sites. To set default meta tags across all pages, add the following to pages/_app.js:

// import Head from 'next/head'

<Head>
  <Meta
    name="Hack Club" // site name
    title="Hackathons" // page title
    description="List of upcoming high school hackathons" // page description
    image="https://hackathons.hackclub.com/card.png" // large summary card image URL
    color="#ec3750" // theme color
    manifest="/site.webmanifest" // link to site manifest
  />
</Head>

If youre not making a site for HQ, dont use @hackclub/meta, since it adds Hack Clubs favicons & info. Instead, we recommend making your own component, perhaps at components/meta.js.

Example code
import Head from 'next/head'
import theme from '@hackclub/theme' // or '../lib/theme'

export default ({
  name = 'Your Company',
  title = 'Your Project',
  description = '',
  image = 'https://yourproject.now.sh/card.png',
  url = 'https://yourproject.now.sh/'
}) => (
  <Head>
    <title>{title}</title>
    <meta property="og:title" content={title} />
    <meta name="twitter:title" content={title} />
    <meta name="og:url" content={url} />
    <meta property="og:type" content="website" />
    <meta property="og:site_name" content={name} />
    <meta name="description" content={description} />
    <meta property="og:description" content={description} />
    <meta name="twitter:description" content={description} />
    <meta property="og:image" content={image} />
    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:image" content={image} />
    <meta name="msapplication-TileColor" content={theme.colors.primary} />
    <meta name="theme-color" content={theme.colors.primary} />
  </Head>
)

Deployment

Deploy with ZEIT Now

We recommend using ZEIT Now for deployment. It requires no configuration, is totally free for personal projects, and supports all the features of Next.js with the best performance. Refer to their documentation for more details.

If youre only making a static site (e.g. no getServerSideProps or API Routes), you can also deploy on Netlify, which is also free. Refer to their documentation on the necessary configuration.