Code Monkey home page Code Monkey logo

blog's Introduction

Netlify Status CI pipeline

Yunpeng's Blog

This repository is meant for Yunpeng's personal blog website. It is proudly powered by Hexo.js. In a previous blog, I shared the reasons why I chose to blog with Hexo.js.

Development

  • Make sure you have installed the latest version of Node.js, Npm and Git on your development machine. Npm should come with Node.js.
    • You chould check them by git --version, node -v and npm -v.
  • Fork and clone this repository to your computer.
git clone --recurse-submodules [email protected]:yunpengn/blog.git
  • Navigate to this directory.
cd blog
  • Install all the dependencies stated in package.json (or package-lock.json).
npm install
  • Run the Hexo server to host the website locally.
npm start
  • Now, you can visit the website at http://localhost:4000/blog/.

Writing

  • Run the following command to create a new post
    • Surround <title> with quotation marks if there exists whitespaces.
hexo new <title>
  • Run the following command to create a draft
hexo new draft <title>
  • Run the following command to transform a draft into a post
hexo publish <title>
  • If you have customize layout under the scaffolds folder, you can apply it by
hexo new <layout> <title>

Deployment

Currently, this blog is being deployed to two environments concurrently, production site on GitHub Pages, as well as staging site on Netlify. The details for these two environments are described as follows respectively.

Production deployment

We use the Git deployer plugin for Hexo to deploy the site to the gh-pages branch, which is then picked up by GitHub Pages automatically.

  • You should have followed the section above to set up the local development environment.
  • Check the settings in _config.yml is correct (see Hexo's documentation for more details):
deploy:
  type: git
  repo: <The URL to your Git repository>
  branch: <The branch for deployment>
  message: <The commit message>
  • Deploy the website by running npm run deploy. Prior to doing this, check that you have access to the Git repository.

Staging deployment

We are also using Netlify as a CI/CD service to host the staging site. The relevant configuration for Netlify can be found in the file netlify.toml. The staging pipeline would run whenever you push the changes to this GitHub repository and there is no manual step involved.

You should take special note that the Hexo.js configuration file for the staging environment is different. This is due to the differences in base URL and root path between the two environments. When running the Hexo commannds, make sure you suffix them with --config _config_netlify.yml.

Troubleshooting

Fetched in submodule path 'themes/next', but it did not contain XXXX. Direct fetching of that commit failed.

This is usually because the master head of the theme repository has been changed recently. Solve this by cd themes/next && git checkout master && git pull.

Acknowledgements

Copyright

Copyright © 2017 - Present by Niu Yunpeng

This project (Yunpeng's Blog) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License ("the licence"). Based on a work at this repository.

The licence generally grants you the freedom that

  • You are free to share, copy and redistribute the material in any medium or format

under the following terms:

  • You must give appropriate credit, provide a link to the license, and indicate if changes were made; and
  • You may not use the material for commercial purposes; and
  • If you remix, transform, or build upon the material, you may not distribute the modified material; and
  • You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

In summary, the licence mentioned above allows you to view and share this work in its original form via any meidum. However, you are NOT allowed to modify it for other uses (such as to create your own website).

A copy of the licence has been attached to this repository, and can be found here. You may seek permissions beyond the scope of this license by contacting the author at [email protected].

Creative Commons License

blog's People

Contributors

dependabot-support avatar dependabot[bot] avatar yunpengn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

blog's Issues

Migrate from Travis CI to GitHub Actions

Feature Request

GitHub Actions have been released for a long time, and it looks very stable and useful. We should migrate from Travis CI to GitHub Actions. Eventually, we want to keep all our tools within GitHub.

Steps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.