npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ghost-static-site-generator

v1.1.4

Published

A simple static site generator for ghost

Downloads

19,172

Readme

Version Node License Stars Forks Issues

ghost-static-site-generator

A tool for generating static sites from ghost blogs. This is based loosely on buster but since that project has been abandoned I've decided to create a new tool.

There are many reasons for wanting to generate a static site. For example security benefits and speed. It's also possible to integrate this tool into a continuous integration process and deploy the generated site.

Prerequisites

You need to have the following installed.

  • Node >=12 or LTS
  • wget v1.16 (Versions prior to will need to use the --silent flag as --show-progress is not available)
  • Chocolatey (Windows only)

Note: Chocolatey usually comes with NodeJS and you don't need to install it separately.

Installation

Linux & Mac

  1. Install wget
$ brew install wget
  1. Install globally the static site generator
$ npm install -g ghost-static-site-generator

Windows

  1. Install wget via chocolatey
$ choco install wget
  1. Install globally the static site generator
$ npm install -g ghost-static-site-generator

Usages

By default the tool will default to http://localhost:2368 for the domain and generate a folder called static in the directory that you run the tool in.

Recipes

Assuming you are hosting locally on http://localhost:2368 and your domain is http://www.myblog.com then you can run the following. You need to pass the url flag because all links need to be replaced with your domain name instead of localhost

$ gssg --url http://www.myblog.com

Assuming you are hosting remotely on http://www.myhiddenserver.com:4538 and your domain is http://www.myblogbucket.com then you can run the following. You need to pass the url flag because all links need to be replaced with your domain name instead of localhost

$ gssg --domain http://www.myhiddenserver.com:4538 --url http://www.myblog.com

Assuming you are hosting remotely on http://www.myhiddenserver.com:4538 and you want to pull into a separate folder instead of static you can use the following command

$ gssg --domain http://www.myhiddenserver.com:4538 --dest myblog-static-folder

API

Generating a static site

This assumes that your site is running locally at http://localhost:2368 and will output to a folder called static.

$ gssg

Generate static site from a custom domain

If your site is not hosted locally you can use the --domain flag to target the your site.

$ gssg --domain "http://localhost:2369"

Generate static site to a custom folder

To change the folder that the static site is generated into using the --dest flag.

$ gssg --dest "myStaticSiteFolder"

Preview site

This will generated the site and then open the site in a new browser window. Please note: If you want to preview the site then the --url flag is ignored. This is because the links need to replace with the preview server's url.

$ gssg --preview

Replace url

Use this flag to replace the url, use this option if your site url differs to your ghost url

$ gssg --url 'http://www.mydomain.com'

Hosting a site in sub directories

Use this flag in conjunction with the --dest flag to host sites in directories. This flag will replace all relative path urls with absolute path urls

$ gssg --dest 'a-random-folder' --subDir 'a-random-folder'

Silent mode

Use this flag to hide wget output

$ gssg --silent

Fail on error

This option will output the failed wget command and also any errors to the stdout before exiting.

$ gssg --fail-on-error

Ignore Absolute Paths

This option is intended for users who do no worry about SEO. This option will make your site truly relative and swap out all domain names for relative paths.

$ gssg --ignore-absolute-paths

Save redirected assets as referer path

This option saves redirected content with the original referer path instead of the destination path. Note: from a file size perspective this is suboptimal as it results in each redirect saving a copy of the original file.

$ gssg --saveAsReferer

Contributing

This is still a work in progress, please feel free to contribute by raising issues or creating pr's.