项目作者: vse-volod

项目描述 :
Editorial theme for Gatsby
高级语言: CSS
项目地址: git://github.com/vse-volod/gatsby-theme-editorial.git
创建时间: 2019-08-31T13:30:06Z
项目社区:https://github.com/vse-volod/gatsby-theme-editorial

开源协议:MIT License

下载


Gatsby Theme Editoral

Demo of Gatsby Starter Blog with Editorial theme

Converted to Gatsby by https://gatsbytemplates.io/

Original theme by html5up https://html5up.net/

Installation

To use this theme in your Gatsby sites, check this example and follow these instructions:

  1. Install the theme

    1. npm i gatsby-theme-editorial
  2. Install dependencies

    1. npm i gatsby-plugin-sass node-sass
  1. Add the theme and sass plugin to your gatsby-config.js:

    1. module.exports = {
    2. plugins: [
    3. `gatsby-theme-editorial`,
    4. `gatsby-plugin-sass`
    5. ]
    6. }
  2. Start your site

    1. gatsby develop

Usage

Pages

In your %pagename%.jsx import Layout component from theme and pass location prop to it:

  1. import Layout from 'gatsby-theme-editorial/src/components/layout'
  2. import '../styles/main.css'
  3. class About extends React.Component {
  4. render() {
  5. console.log(this.props)
  6. return (
  7. <Layout location={this.props.location}>
  8. <Helmet
  9. htmlAttributes={{ lang: 'en' }}
  10. ></Helmet>
  11. <section>
  12. <header className="main content">
  13. <h1>About</h1>
  14. </header>
  15. <div className="content">We are people</div>
  16. </section>
  17. </Layout>
  18. )
  19. }
  20. }

Blog Posts

In your src/templates/blog-post.js, make a query and re-export template from theme, following this example:

  1. import React from 'react'
  2. import { graphql } from 'gatsby'
  3. import BlogPostTemplate from 'gatsby-theme-editorial/src/components/blog-post'
  4. export default BlogPostTemplate
  5. export const pageQuery = graphql`
  6. query BlogPostBySlug($slug: String!) {
  7. site {
  8. siteMetadata {
  9. title
  10. author
  11. description
  12. social {
  13. twitter
  14. facebook
  15. snapchat
  16. instagram
  17. medium
  18. }
  19. menuLinks {
  20. name
  21. link
  22. }
  23. contact {
  24. info
  25. email
  26. tel
  27. address
  28. }
  29. }
  30. }
  31. markdownRemark(fields: { slug: { eq: $slug } }) {
  32. id
  33. excerpt
  34. html
  35. frontmatter {
  36. title
  37. date(formatString: "MMMM DD, YYYY")
  38. }
  39. }
  40. allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
  41. edges {
  42. node {
  43. excerpt
  44. fields {
  45. slug
  46. }
  47. frontmatter {
  48. date(formatString: "DD MMMM, YYYY")
  49. title
  50. }
  51. }
  52. }
  53. }
  54. }
  55. `

Support

Any bugfixes, bug reports and feature requests are welcome.