All Projects → juliancwirko → create-harold-app

juliancwirko / create-harold-app

Licence: MIT license
Static blog/site generator

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to create-harold-app

Next Cms Ghost
Publish flaring fast blogs with Next.js and Ghost CMS
Stars: ✭ 107 (+224.24%)
Mutual labels:  static-site-generator, blogging
Gatsby Theme Try Ghost
A Gatsby theme to build flaring fast blogs from headless Ghost CMS
Stars: ✭ 88 (+166.67%)
Mutual labels:  static-site-generator, blogging
Statiq.web
Statiq Web is a flexible static site generator written in .NET.
Stars: ✭ 1,358 (+4015.15%)
Mutual labels:  static-site-generator, blogging
Eleventy Starter Boilerplate
🚀 Eleventy Starter is production-ready with SEO-friendly for quickly starting a blog. ⚡ Built with Eleventy, ESLint, Prettier, Webpack, PostCSS, Tailwind CSS and Netlify CMS (optional).
Stars: ✭ 139 (+321.21%)
Mutual labels:  static-site-generator, blogging
Gatsby Starter Try Ghost
Publish flaring fast blogs with Gatsby and Ghost
Stars: ✭ 137 (+315.15%)
Mutual labels:  static-site-generator, blogging
Align
a single static blog generater use vue components and markdown files
Stars: ✭ 92 (+178.79%)
Mutual labels:  static-site-generator, blogging
sutanlab.id
☕️ My Personal Homepage & Blog site with NextJS. 🇺🇸 🇮🇩
Stars: ✭ 39 (+18.18%)
Mutual labels:  static-site-generator, blogging
gisture
A minimal and flexible blog generator based on GitHub Gist.
Stars: ✭ 24 (-27.27%)
Mutual labels:  static-site-generator, blogging
influencer-hugo
Influencer is a Hugo theme for book authors and writers. It has also Snipcart supports for order books and payments.
Stars: ✭ 66 (+100%)
Mutual labels:  static-site-generator
noir
Noir is a modern, responsive and customizable theme for Jekyll with dark mode support.
Stars: ✭ 68 (+106.06%)
Mutual labels:  static-site-generator
jigsaw-docs-template
Starter template for a documentation site, using Jigsaw by Tighten
Stars: ✭ 39 (+18.18%)
Mutual labels:  static-site-generator
generator-veams
Scaffold modern frontend web apps or web pages with a static site generator (Assemble or Mangony), Grunt and/or Gulp, Sass and Bower. Use modern frameworks like Bourbon, Bootstrap or Foundation and structure your JavaScript with ES Harmony support.
Stars: ✭ 45 (+36.36%)
Mutual labels:  static-site-generator
rocket
The modern web setup for static sites with a sprinkle of JavaScript
Stars: ✭ 169 (+412.12%)
Mutual labels:  static-site-generator
jekyll-rdf
📃 A Jekyll plugin to include RDF data in your static site or build a complete site for your RDF graph
Stars: ✭ 46 (+39.39%)
Mutual labels:  static-site-generator
github-pages-vuepress
Build a static website using VuePress and deploy to Github Pages
Stars: ✭ 20 (-39.39%)
Mutual labels:  static-site-generator
oliverbenns.com
oliverbenns.com
Stars: ✭ 51 (+54.55%)
Mutual labels:  static-site-generator
gatsby-attila-theme-ghost
A Gatsby theme plugin for creating blogs from headless Ghost CMS.
Stars: ✭ 16 (-51.52%)
Mutual labels:  blogging
ftd
🚧 (Alpha stage software) FTD: Programming Language For Prose 🚧
Stars: ✭ 18 (-45.45%)
Mutual labels:  static-site-generator
monopati
a minimalistic static content generator
Stars: ✭ 19 (-42.42%)
Mutual labels:  static-site-generator
wasp
A Static Site Generator written in Crystal.
Stars: ✭ 20 (-39.39%)
Mutual labels:  static-site-generator

create-harold-app

Harold is a static site and blog generator based on Handlebars and Markdown. With a built-in search engine and ready-to-use responsive templates, including the one for docs websites.

harold js image

Intro

Static sites and blogs with HaroldJS

Documentation

www.haroldjs.com

Demo

Creating an app

npx
npx create-harold-app my-app

(npx is a package runner tool that comes with npm 5.2+ and higher, see instructions for older npm versions)

npm
npm init harold-app my-app

npm init is available in npm 6+

Yarn
yarn create harold-app my-app

yarn create is available in Yarn 0.25+

It will create a directory called my-app inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies.

As an option, you can choose with which template it should init the project. Possible choices:

  • default
  • docs
  • bare

If you want to init the project with docs template, pass additional option -t docs. For example: npm init harold-app my-app -t docs or with npm 7+ npm init harold-app my-app -- -t docs. The same for bare template.

Write create-harold-app --help in a terminal to get the list of options.

Custom templates

You can prepare your template and reuse it on every new project initialization. You can do this by passing a path to your zip package. It can be a remote, hosted file or one from a local file system.

Examples:

npm init harold-app my-app -t https://github.com/juliancwirko/harold-template-scaffold/archive/refs/heads/main.zip

with npm 7+

npm init harold-app my-app -- -t https://github.com/juliancwirko/harold-template-scaffold/archive/refs/heads/main.zip

Or it can be also local file:

npm init harold-app my-app -t ./main.zip

with npm 7+

npm init harold-app my-app -- -t ./main.zip

Read more about it in the docs here: Custom templates.

Starting the app

From the newly created app's directory (in our case, my-app), run npm start. It will serve the app under localhost:3000. To change the port, just add PORT env, like: PORT=3002 npm start.

Configuration

Harold will search up the directory tree for configuration in the following places:

  • a harold property in package.json
  • a .haroldrc file in JSON or YAML format
  • a .haroldrc.json, .haroldrc.yaml, .haroldrc.yml, .haroldrc.js, or .haroldrc.cjs file
  • a harold.config.js or harold.config.cjs CommonJS module exporting an object

You can configure the directory for md files (by default posts) and the directory for md files layouts (by default blog-layouts). Quite helpful because these names are also used in urls. For example, by default, /posts/name-of-the-post (name of the .md file), but you might want to build the docs website and have /docs/name-of-the-doc (name of the .md file).

You can also configure the name for output directory using outputDirName and if you want to host your site in subdirectory you would also need to add hostDirName.

Example of .haroldrc (placed in the root of the app or in the src directory):

{
  mdFilesDirName: 'docs',
  mdFilesLayoutsDirName: 'docs-layouts',
  outputDirName: 'dist',
  hostDirName: 'subfolder-name'
}

Remember to change these directories' names after you init your app. If you are using the search system, change postsPath in harold-search.js.

Updating harold-scripts

  1. Check if there are any breaking changes in the CHANGELOG.md
  2. In your project, update the version of harold-scripts package

Some of the recipes

Below are ready-to-use recipes. You can take them as inspiration or copy it as it is and use in your custom template. See more at www.haroldjs.com

Posts categories

You can use postsList Handlebars helper with perPageLimit param. You can use tags as categories. Posts will be divided into sections and listed by tag name.

<div class="homepage-section homepage-section-bg">
  <div class="container">
    <h1 class="homepage-header">Coding</h1>
    {{postsList
    perPageLimit=3
    currentPage=1
    className="post-list-items"
    dateFormat="dd mmmm yyyy"
    byTagName="coding"
    readMoreButtonLabel="&#8674;"
    }}
  </div>
</div>

<div class="homepage-section">
  <div class="container">
    <h1 class="homepage-header">Art and Design</h1>
    {{postsList
    perPageLimit=3
    currentPage=1
    className="post-list-items"
    dateFormat="dd mmmm yyyy"
    byTagName="art"
    readMoreButtonLabel="&#8674;"
    }}
  </div>
</div>

Similar posts

You can use the postsList with byTagName, which you should set up the same as the current post tag or tags. This way, you will be able to display a similar posts list. Remember to do this in the layout hbs file, not in Markdown files.

{{postsList
  className="docs-articles-list"
  byTagName=tags.[0]
}}

Featured post

{{postsList
  perPageLimit=1
  currentPage=1
  className="homepage-featured-post"
  dateFormat="dd mmmm yyyy"
  noTags=true
  noExcerpt=true
  noDate=true
  byTagName="featured"
  readMoreButtonLabel="Lets dive in!"
}}

Adding robots.txt, manifest.json, and any other statics

In many cases, there is a need to add some custom files to the root of your website. You can do this using the optional src/statics directory. Example: src/statics/robots.txt will be placed in build/robots.txt next to your index.html file. You can also nest your directories like src/statics/some-dir/some-dir/file.txt. It will land in build/some-dir/some-dir/file.txt.

Hosting: GitHub Pages

If you want to host Harold's website under your main username (username.github.io), you would need to rename your output directory to supported by Github. It is the docs directory. You would need to create a .haroldrc file and put the output directory name there.

{
  outputDirName: 'docs',
}

Build your Harold app and push it to the repo. Remember to add the .gitignore file, and exclude node_modules but keep the output directory (docs).

Configure your Github Pages to take the source from the docs directory.

Here is the quick walk-through video on how to do that:

If you want to host Harold's website under the repository subdirectory name (username.github.io/my-blog), you need to add hostDirName and remember to keep your paths in order. You can use the relativePath handlebars helper. The default template (from v0.4.0) is already using it, so it should work as-is.

{
  outputDirName: 'docs',
  hostDirName: 'my-blog'
}

Hosting: Netlify

With Netlify, it is a little bit simpler. You just need to point to the Git branch and directory you want to deploy your site. You don't even need the source in the repo because Netlify will run the build scripts for you.

Here is the quick walk-through video on how to do that:

Why another one?

I wanted to have a simple static site generator to build and host on Netlify. There are many such solutions, but I wanted to have complete control.

What is essential, I equipped it with three templates that you can use and modify for your needs. I prepared the templates system for custom ones in the future. I also plan to provide some other complete thematic templates.

When to use it

  • when you want to build a static website/blog with simple search functionality (default theme)
  • when you want to build a small (maybe medium) site or blog
  • when you don't want to use any big and complicated solution
  • when you know how to use the Handlebars template system

When not to use it

  • when you want to build bigger projects (not tested with big projects, tested with over 120 markdown files, works quite fast)
  • when you don't want to use Scss (you can still write standard CSS in .scss files) or Handlebars
  • when you want to rely on something which has big community

License

MIT

Articles

Harold is built upon these excellent tools:

Contact

julian.io

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].