Giter Site home page Giter Site logo

calpa / gatsby-starter-calpa-blog Goto Github PK

View Code? Open in Web Editor NEW
332.0 8.0 63.0 13.21 MB

Calpa's Blog (GatsbyJS Starter X Netlify CMS)

Home Page: https://v1.calpa.me/

License: MIT License

JavaScript 81.91% HTML 1.17% SCSS 16.91%
gatsbyjs react blog template-project gatsby-starter gatsby-blog gatsby netlify reactjs

gatsby-starter-calpa-blog's Introduction

Gatsby Starter - Calpa's Blog

GitHub license Accept Pull Requests Twitter Greenkeeper badge Build Status CodeFactor Netlify Status

繁體中文 | 简体中文 | English

Home Page

Build a blog system like Calpa's Blog in ease.

If you like this project, please don't hesitate to star it. Thank you.

Feature

Structure

  1. GatsbyJS v2, faster than faster
  2. Google Analytics
  3. Offline support
  4. Web App Manifest
  5. Page pagination
  6. Netlify optimization
  7. Awesome comment component (powered by Gitalk)
  8. Search Engine Optimization
  9. Parse Markdown in high speed (powered by gatsby-transformer-remark)
  10. Support to sitemap

Design

  1. Pagination
  2. Responsive Web Design
  3. Font Awesome is auto loaded (powered by react-fontawesome)
  4. Scroll smoothly (powered by smooth-scroll)

Data Source

You can edit the posts in /src/content/*.md, or using Netlify-cms to edit the posts.

Customization for developers

  1. SEO
  2. Styled using SCSS
  3. Data Source

Get Started

Deploy with Netlify

Use the button below to build and deploy your own copy of the repository:

Deploy to Netlify

After clicking that button, you’ll authenticate with GitHub and choose a repository name. Netlify will then automatically create a repository in your GitHub account with a copy of the files from the template.

Next, it will build and deploy the new site on Netlify, bringing you to the blog system when the build is complete.

Code with Codesandbox

Use the button below to code with the blog system:

Edit blog

Prerequisites

  1. Git
  2. Node: any 8.x version starting with 8.5.0 or greater
  3. A fork of the repo (for any contributions)
  4. A clone of the this repo on your local machine

Develop

How to start this project?

  1. Install Gatsby-CLI
npm install --global gatsby-cli
  1. Create new Gatsby project using this starter, awesome-blog is your blog's folder
gatsby new awesome-blog https://github.com/calpa/gatsby-starter-calpa-blog
  1. Open the folder
cd awesome-blog
  1. Run Development Server

    1. npm start to start the hot-reloading development server (powered by Gatsby)
    2. open http://localhost:8000 to open the site in your favorite browser

Configuration

Edit the export object in data/config

Note: To look up theme_color hex code, click here.

module.exports = {
  title: 'your blog title here',
  maxPages: 12
  meta: {
    description: 'blog description',
    keyword: 'blog, JavaScript',
    theme_color: '#hexcode',
    favicon: 'https:yourimageurl.com',
    google_site_verification: 'your google verification hash',
  },
  name: 'your name',
  email: '[email protected]',
  iconUrl: 'https://youricon.jpg',
  License: 'by',
  url: 'https://yourblog.me',
  about: '/2018/05/01/about-your-name/',
  // Sidebar
  zhihuUsername: 'your zhiu user name here',
  githubUsername: 'your github user name here',
  friends: [
    {
      title: 'friend title',
      href: 'link to their blog',
    }
  ]

Plugins in the configuration file:

gaOptimizeId: 'GTM-WHP7SC5',
gaTrackId: 'UA-84737574-3',
navbarList: [
  {
    href: '/stats/',
    title: 'stat title',
  },
  {
    href: '/tags/',
    title: 'tags',
  },
  {
    href: '/guestbook/',
    title: 'guestbook',
  },
  {
    href: '/2018/10/04/about-your-blog/',
    title: 'your title',
  },
],
redirectors: [
  {
    fromPath: '/',
    toPath: '/page/1',
  },
],

Gitalk plugin configuration

gitalk: {
    clientID: '18255f031b5e11edd98a',
    clientSecret: '2ff6331da9e53f9a91bcc991d38d550c85026714',
    repo: 'calpa.github.io',
    owner: 'calpa',
    admin: ['calpa'],
    distractionFreeMode: true,
  },
}

Deploy

Calpa's blog is currently using Netlify, though, you may use Github Pages as an alternative.

  • Github Pages

    npm run deploy to deploy the blog to Github Pages

  • Netlify

    Auto Deploy

Troubleshooting

  • For window is defined, wrap the require in check for window:

    if (typeof window !== `undefined`) {
      const module = require("module");
    }
  • npm run reset to clear the local cache

  • Check GatsbyJS Debugging Docs

Contributing

Please read CONTRIBUTING.md for more information.

And don't hesitate to put your star and watch this starter project.

Contact

If you are interested in this project, please feel free to contact Calpa Liu.

Thanks For Contribute... :)

gatsby-starter-calpa-blog's People

Contributors

4geru avatar adamk1230 avatar calpa avatar code-factor avatar depfu[bot] avatar dmhalejr avatar elsangedy avatar faisalkholid avatar frankmckechnie avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hu-qi avatar huangyz0918 avatar imgbotapp avatar jmartin84 avatar maisamilena avatar mclofton avatar nivedhasunderraj avatar publicwc avatar sarahlizdettloff avatar solirpa avatar vindu939 avatar yaoandy107 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-starter-calpa-blog's Issues

Fix friend site referrer

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Home page
  2. See left sidebar

Expected behavior
rel="noopener" instead of rel="external nofollow noopener noreferrer"

Solution:

  1. change code in src/components/ExternalLink/index.js
  2. Add default rel="external noopener" in ExternalLink.defaultProps`

Add Chinese README.md

Is your feature request related to a problem? Please describe.
新增繁體中文,简体中文 README.md

Describe the solution you'd like
Translate the README.md into chinese version

Fix pagination total page number

Describe the bug
For now, the total page number is hard coded.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Home Page'
  2. Scroll down to '1'
  3. See error

Expected behavior
The total page number will be calculated during the producing of pages template.
If there is only one page, then return max number of pages = 1

Screenshots
Imgur

Additional context
Add any other context about the problem here.

Remove redux from this project

As the blog is view and using Gitalk comment system, there is no complicated actions included in this blog system.

Remove actions, reducers and state Redux components.

An in-range update of @fortawesome/free-brands-svg-icons is breaking the build 🚨

The dependency @fortawesome/free-brands-svg-icons was updated from 5.4.1 to 5.4.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@fortawesome/free-brands-svg-icons is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

An in-range update of gatsby is breaking the build 🚨

The dependency gatsby was updated from 2.0.32 to 2.0.33.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

gatsby is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 6 commits.

  • 59daee4 chore(release): Publish
  • c543b0e Fix unit test trigger — compare branch instead of last commit (#9478)
  • 7d31fe7 feat(gatsby): Add nodes db module (#9416)
  • 343f9e6 chore(release): Publish
  • 2a66958 feat: use hashed folder names instead of filenames. closes #6232 (#8808)
  • 3620cd0 Make text a little less wordy, as people generally don't read long text on-screen (#9494)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Update README.md

  1. Update badges
    1.1. Travis CI: TravisCI
    1.2. CodeFactor: CodeFactor

  2. Fix typos (any)

  3. Update Responsive Screenshot

Update features in README.md

Is your feature request related to a problem? Please describe.
This project has installed many plugins, yet the features of this project is still in old version.

Describe the solution you'd like

  1. Read package.json
  2. Read gatsby-config.js to confirm which plugins are used
  3. Update the Feature part in README.md

One more thing, the card component will hide the card image if there is no card image provided.

关于 NODE_ENV=development

环境

$ npm version
{ blog: '1.0.0',
  npm: '6.4.1',
  ares: '1.15.0',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  llhttp: '1.0.1',
  modules: '67',
  napi: '3',
  nghttp2: '1.34.0',
  node: '11.4.0',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.24.0',
  v8: '7.0.276.38-node.13',
  zlib: '1.2.11' }

Windows 下一直报错如下

$ npm start

> [email protected] start C:\Code\test
> npm run fetch:config && npm run develop


> [email protected] fetch:config C:\Code\test
> NODE_ENV=development node ./scripts/index.js

'NODE_ENV' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] fetch:config: `NODE_ENV=development node ./scripts/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] fetch:config script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mkb\AppData\Roaming\npm-cache\_logs\2018-12-16T04_09_04_527Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run fetch:config && npm run develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mkb\AppData\Roaming\npm-cache\_logs\2018-12-16T04_09_04_619Z-debug.log

尝试直接指定 config 后可以成功运行

// ./package.json
"fetch:config": "node ./scripts/index.js",

// ./gatsby/getPosts.js
require('dotenv').config({
  path: `.env.development`,
});

我不是程序员,所以也不太理解是什么原因,另外中文文档里配置文件缺一行

API_BASE_URL = 'https://cdn.contentful.com'

An in-range update of gatsby-plugin-offline is breaking the build 🚨

The dependency gatsby-plugin-offline was updated from 2.0.5 to 2.0.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

gatsby-plugin-offline is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Fix propType is not required, but has no corresponding defaultProp declaration in src\html.js

CodeFactor found multiple issues:

propType "body" is not required, but has no corresponding defaultProp declaration.

src\html.js:65
Commit dd755fd

propType "htmlAttributes" is not required, but has no corresponding defaultProp declaration.

src\html.js:55
Commit 106dc22

propType "headComponents" is not required, but has no corresponding defaultProp declaration.

src\html.js:56
Commit 106dc22

propType "bodyAttributes" is not required, but has no corresponding defaultProp declaration.

src\html.js:60
Commit 106dc22

propType "preBodyComponents" is not required, but has no corresponding defaultProp declaration.

src\html.js:61
Commit 106dc22

propType "postBodyComponents" is not required, but has no corresponding defaultProp declaration.

src\html.js:66
Commit 106dc22

Open a new tab when user click external links

Is your feature request related to a problem? Please describe.
User may bounced out when they click the links inside the post content, as it is using markdown renderer.

Describe the solution you'd like
Change renderer of href to this:

<a
    href={href}
    rel="external nofollow noopener noreferrer"
    target={target}
  >
    {title}
  </a>

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Use the online environment.

Install OneSingal to send web notification

Is your feature request related to a problem? Please describe.
OneSignal provides a simple interface to push notifications and email, letting content creators focus on quality user engagement instead of complex implementation.

Describe the solution you'd like
Install it.

Describe alternatives you've considered
Build a web push notification system

An in-range update of react is breaking the build 🚨

There have been updates to the react monorepo:

    • The dependency react was updated from 16.6.1 to 16.6.2.
  • The dependency react-dom was updated from 16.6.1 to 16.6.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of stylelint-scss is breaking the build 🚨

The devDependency stylelint-scss was updated from 3.3.2 to 3.4.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

stylelint-scss is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 13 commits.

  • 8cb1656 Prepare version 3.4.0
  • baa0e66 Merge pull request #283 from kristerkari/bugfix/correctly-handle-parameters-in-partial-no-import
  • 2089d5f fix typo [ci skip]
  • e2f9e64 Add test
  • 17a5941 partial-no-import: correctly handle import parameters with urls
  • 885fefd Merge pull request #280 from niksy/at-mixin-argumentless-call-parentheses-fix
  • 4fdc378 Add "at-mixin-argumentless-call-parentheses" autofix
  • 921b294 Merge pull request #281 from kristerkari/feat/dependencies-bump
  • d298945 Update dependencies to latest versions
  • ec91b1c remove unused npm script
  • ad53965 Use eslint-plugin-lodash to avoid possible errors with Lodash
  • 2baa882 make contributor avatars bigger
  • f9650f8 Add a list of contributors

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of gatsby-plugin-offline is breaking the build 🚨

The dependency gatsby-plugin-offline was updated from 2.0.9 to 2.0.10.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

gatsby-plugin-offline is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

[优化] 如何在博客系统直接使用 GitalkComponent?

现在博客评论系统使用的是 Gitalk,但是 webpack-bundle-analyzer 显示 gitalk 为占据很大部分位置,故希望优化改进。

我看了一下源码,发现 /src/index.js 在[/src/gitalk.jsx] 上面引用,並使用渲染的 render 函数。

修改思路如下:

  1. 在博客文章内页将 render 函数改为 import GitalkComponent from 'gitalk/src/gitalk'
  2. 将 options 透过 props 传进去这个组件

我想如果是同属 React 阵营的话,那么应该可以直接调用 gitalk/src/gitalk。然而,我却遇到一点问题,希望可以作者解答一下。

博客源码:https://github.com/calpa/blog
调用部分:src/templates/blog-post.js

备注:这个问题属于优化部分,不影响博客正常使用。

gitalk/gitalk#196

An in-range update of gatsby-plugin-offline is breaking the build 🚨

The dependency gatsby-plugin-offline was updated from 2.0.10 to 2.0.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

gatsby-plugin-offline is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Extract Gitalk data to data/config.js

In src/templates/blog-post.js and src/templates/blog-post.js, the Gitalk configuration are hard coded.

const gitalk = new Gitalk({
      clientID: '18255f031b5e11edd98a',
      clientSecret: '2ff6331da9e53f9a91bcc991d38d550c85026714',
      repo: 'calpa.github.io',
      owner: 'calpa',
      admin: ['calpa'],
      distractionFreeMode: true,
      title: finalTitle,
      id,
    });

They should be stored in central configuration: data/config.js.

TODO:

Extract the parameters in Gitalk and store them into data/config.js.

Add CONTRIBUTING.md

In order to get ready the project for more contributors, CONTRIBUTING.md is required to be added.

The bottom part is extracted from a good CONTRIBUTING.md example: watson-developer-cloud/assistant-simple

Code:

Commits should follow the Angular commit message guidelines. This is because our release tool uses this format for determining release versions and generating changelogs.

Issues:

If you encounter an issue with the Node.js library, you are welcome to submit a bug report. Before that, please search for similar issues. It's possible somebody has already encountered this issue.

Pull Requests:

If you want to contribute to the repository, follow these steps:

Fork the repo.
Develop and test your code changes: npm install
Commit your changes.
Push to your fork and submit a pull request.

The only thing to do is to add a CONTRIBUTING.md file.

Query config from remote server instead of coding in the project

Is your feature request related to a problem? Please describe.
When I need to update the blog config, I need to clone the project, and change the config.js.
It seems that violated the spirit of this project...

Describe the solution you'd like

  1. Get the config.js from remote server
  2. Query the project config from GraphQL

Describe alternatives you've considered
Add config.js to .gitignore and add template of config.js such as config-template.js, but it still need to code...

An in-range update of gatsby is breaking the build 🚨

The dependency gatsby was updated from 2.0.35 to 2.0.36.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

gatsby is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 22 commits.

  • c330454 chore(release): Publish
  • 32f786a Implement two fallbacks for getting extension when creating remote file (#9349)
  • d243222 add tutorial for gatsby+contentful+netlify (#9618)
  • 0c0ac46 examples: Minimal mobx example (#9064)
  • 3a8a781 Remove eslint-plugin-flow-vars (#9622)
  • a9b8a81 chore: removed unused imports and changes related to code formatting (#9610)
  • 9c481f4 feat(www): better social sharing support (#9291)
  • a55bc13 feat(gatsby-plugin-sass): Accept css-loader options (#9462)
  • 2df5368 feat(showcase): add QHacks to site showcase (#9617)
  • 53c7e25 Update Strapi article : Building a static blog using Gatsby and Strapi (#9569)
  • 1631d33 feat(showcase): add Asian Art Museum to showcase (#9589)
  • 00284e0 fix(gatsby-plugin-offline): don't precache the index page (#9603)
  • 0f97ea3 docs: add missing eslint-plugin-node plugin to eslint docs (#9600)
  • 47a800c fix(gatsby-source-mongodb): sanitize type of nodes to only contain alphanumeric chars and underscores (#7246)
  • 00f2992 Add Clubhouse to showcases (#9604)

There are 22 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.