Useful shortcodes
The set of the implementations for some shortcodes. These shordcodes can be used for managing content on the Hugo website. The main goal of this project is creating useful shortcodes, that will be optimized for working fast.
This project used the hugo-init boilerplate, but the shortcode implementations can be migrated on other project templates/build tools without any issues.
Here is the live demo: https://useshortcodes.netlify.com/
Please note by using this project you understand the implications and guarantees of the MIT license.
Requirements
Before start you already need to have these applications on aboard:
- Node 6.x+ (LTS version) and npm (shipped with node installation)
Installation
Clone project and install all dependencies by running these commands:
$ git clone https://github.com/serg/use-shortcodes.git
$ cd use-shortcodes
$ npm install
Development mode
Build assets with Brunch and Hugo, start a development server:
$ npm start
The application will be available at the http://localhost:1313 link in your browser.
All changes in the src/ and site/ folders will be synced and displayed in browser automatically.
Production mode
To build the application for production use this command:
$ npm run build
All created files will be available in the public/ folder of project.
Preview mode
To build the application like for production, but with some restrictions use the command:
$ npm run preview
A website will be generated by applying almost all production features, except:
- all draft pages are included;
- the Google Analytics code is absent on the pages;
- all pages have the rules for prevent of indexing by search engines if you deploy website on a hosting for the testing reasons;
- the
robots.txt file has a rule for prevent of indexing a whole website.
All above restrictions will be applied for the development mode also, except the assets (js, css) optimization and minification.
You can find the files of website in the public/ folder as always.
Restrictions for production
Your markdown file (in content/ folder) needs to be not a draft for including its content into a website template. Change the draft value to false inside a certain page for publishing its content:
draft: false
All website pages contain the noindex and nofollow values in the meta tags when website was generated in the development or preview mode. Also the Google Analytics is absent on a page and the robots.txt file has an option for prevention of indexing by search engines.
When you will be ready to share your website with a world please run the build of application in the production mode.
Deployment of a website
You can move the generated website from the public/ folder to on any type of a hosting provider for the static files. One of an option for the simplest and fastest deploying your site is using the Netlify service. Besides the Netlify provide a great service with a lot of features for free and your website will never slow down the speed of loading for a webpage when deliver it to your users. The instructions for the deploying to Netlify below.
Now Netlify will build and deploy your site whenever you push to git.
License
MIT © Sergey Furtak
评论