An opinionated starter project for Hugo that takes advantage of Hugo's built in asset pipeline.
Flightdeck for Hugo is an opinionated starter project for Hugo that takes advantage of Hugo's built in asset pipeline.
Includes:
- Base templates using HTML with partials creating components.
- Hugo Pipes ready to compile, minify, and MD5-hash for Scss/CSS and JavaScript with environment variables.
- Hugo Pipes for PostCSS using Autoprefixer and PurgeCSS
- Simple Google Analytics integration.
- Imagemin for image optimization
- Please note that Hugo's built in image processing does not work on images located inside of
/static
. This is why we chose to use Gulp and Imagemin.
- Please note that Hugo's built in image processing does not work on images located inside of
- Deployment with rsync and Flightdeck Liftoff.
Flightdeck for Hugo IS NOT a Hugo theme. It CANNOT be dropped inside the /themes
directory.
Make sure that Hugo is installed by checking out the Quick Start Guide on the Hugo docs... make sure you're running the extended version.
First things first, clone this repo:
git clone git@github.com:flight-deck/Flightdeck-for-Hugo.git MY-HUGO-PROJECT && cd MY-HUGO-PROJECT
Then run the Node commands
pnpm
pnpm start
OR
npm install
npm start
To add main site pages run the hugo new
command and create a markdown file in the pages/
directory. Then create a corresponding html
template file in layouts/pages/
Example:
hugo new pages/my-new-page.md
The header.html
partial is configured to generate a main site navigation by utilizing Hugo Menu Templates. The pages.md
archetype sets each page markdown file to the main menu via front matter.
There are 4 available Scripts:
pnpm start
- Runs development server with CSS sourcemaps and drafts enabled, as well as the image task with watch.pnpm build:preview
- Runs the server withproduction
for the environment with asset minification and postCSS enabled, and optimized imagespnpm build
- The same asbuild:preview
but builds production ready site inpublic
directory with minified/optimized assetspnpm build:images
- Runs gulp images task to optimize images in./static/img/
pnpm deploy
- uses (Flightdeck Liftoff)[https://github.com/flight-deck/Flightdeck-Liftoff] for deployments, see Liftoff for usage- Please note: Hugo's built in deployment options currently does not support DigitalOcean
pnpm clean:node
- removes only Node dependenciespnpm clean:site
- removes thepublic/
directorypnpm purge
- removes everything and does a fresh install using pnpm.
β
βββββ /archetypes - Hugo archetypes
β
βββββ /assets - Source files for scss, js, and images
β ββββ /images - Images INPUT directory used by Gulp
β ββββ /js
β ββββ /scss
β
βββββ /content - Hugo Content Directory
β ββββ /pages - Markdown files for main site pages
β |
β | _index.md - Site homepage markdown file
β
βββββ /layouts - Template files
β ββββ /_default
β |
β | baseof.html - Base template
β β
β ββββ /pages - Template files for main site pages
β β
β ββββ /partials
β ββββ /site - Site partials
β β
β β footer.html - Site primary <footer>
β β header.html - Site primary <header>
β β meta.html - Site <meta> tags
β β scripts.html - JavaScript <script> tags before closing </body>
β β styles.html - Stylesheets referenced before closing </head>
β β
β β 404.html - 404 Template
β β index.html - Home page
β
βββββ /static - Hugo static resources
β ββββ /images - Images OUTPUT directory generated by Gulp
β
β config.yml - Hugo configuration file
β gulpfile.js - Gulp js file
β netlify.toml - Netlify configuration file
β package.json
β README.md - The README file you're reading right now