gatsby-config.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. const { version, homepage } = require('./package.json');
  2. const cdn = process.env.USE_LOCAL_FILE
  3. ? `http://localhost:${process.env.npm_package_config_ports_webpack}`
  4. : `https://cdn.jsdelivr.net/npm/quill@${version}/dist`;
  5. const siteMetadata = {
  6. version,
  7. cdn,
  8. github:
  9. 'https://github.com/quilljs/quill/tree/develop/packages/website/content',
  10. highlightjs: '//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0',
  11. katex: '//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1',
  12. url: homepage,
  13. title: 'Quill - Your powerful rich text editor',
  14. shortTitle: 'Quill Rich Text Editor',
  15. description:
  16. 'Quill is a free, open source WYSIWYG editor built for the modern web. Completely customize it for any need with its modular architecture and expressive API.',
  17. shortDescription:
  18. 'Quill is a free, open source rich text editor built for the modern web.',
  19. };
  20. const config = {
  21. siteMetadata,
  22. graphqlTypegen: true,
  23. plugins: [
  24. 'gatsby-plugin-sass',
  25. {
  26. resolve: 'gatsby-plugin-react-svg',
  27. options: {
  28. rule: {
  29. include: /svg/,
  30. },
  31. },
  32. },
  33. {
  34. resolve: 'gatsby-source-filesystem',
  35. options: { name: 'content', path: `${__dirname}/content` },
  36. },
  37. {
  38. resolve: 'gatsby-plugin-mdx',
  39. options: {
  40. gatsbyRemarkPlugins: [
  41. {
  42. resolve: 'gatsby-remark-find-replace',
  43. options: {
  44. replacements: Object.keys(siteMetadata).reduce((acc, key) => {
  45. acc[`{{site.${key}}}`] = siteMetadata[key];
  46. return acc;
  47. }, {}),
  48. prefix: false,
  49. },
  50. },
  51. ],
  52. },
  53. },
  54. {
  55. resolve: `gatsby-plugin-feed`,
  56. options: {
  57. query: `
  58. {
  59. site {
  60. siteMetadata {
  61. url
  62. }
  63. }
  64. }
  65. `,
  66. feeds: [
  67. {
  68. serialize: ({ query: { site, allMdx } }) => {
  69. return allMdx.nodes.map((node) => {
  70. return Object.assign({}, node.frontmatter, {
  71. description: node.excerpt,
  72. date: node.frontmatter.date,
  73. url: site.siteMetadata.url + node.fields.permalink,
  74. guid: site.siteMetadata.url + node.fields.permalink,
  75. });
  76. });
  77. },
  78. query: `
  79. {
  80. allMdx(
  81. sort: { fields: frontmatter___date, order: DESC }
  82. filter: { fields: { pageType: { eq: "blog" } } }
  83. ) {
  84. nodes {
  85. frontmatter {
  86. date(formatString: "DD MMM yyyy")
  87. title
  88. }
  89. fields {
  90. permalink
  91. }
  92. id
  93. body
  94. excerpt
  95. }
  96. }
  97. }
  98. `,
  99. output: '/feed.xml',
  100. title: siteMetadata.title,
  101. match: '^/blog/',
  102. },
  103. ],
  104. },
  105. },
  106. {
  107. resolve: 'gatsby-plugin-google-gtag',
  108. options: {
  109. trackingIds: ['G-B37E2WMSPW'],
  110. },
  111. },
  112. ],
  113. };
  114. module.exports = config;