disqus test

This commit is contained in:
Sergey Yarkov 2020-07-21 19:28:32 +03:00
parent 20baa9c3ff
commit 707b98f8a5
7 changed files with 70 additions and 42 deletions

38
config.js Normal file
View File

@ -0,0 +1,38 @@
module.exports = {
title: 'devthread.ru',
keywords: 'веб разработка, javascript, seo, программирование, reactjs, graphql',
siteName: 'Cборник статей и руководств - devthread.ru',
titleTemplate: '%s · статьи и руководства по веб-разработке',
description: 'Cборник статей и руководств по тематике веб-разработки и IT для того чтобы помочь вам',
url: 'https://devthread.netlify.app',
menuLinks: [
{
name: 'Статьи',
link: '/articles'
},
{
name: 'О сайте',
link: '/about'
},
{
name: 'Контакты',
link: '/contacts'
},
{
name: 'Сниппеты',
link: '/snippets'
}
],
social: {
email: 'support@devthread.ru',
telegram: 'https://t.me/devthread',
twitter: 'https://twitter.com/devthread',
yadzen: 'https://zen.yandex.ru/'
},
options: {
articles: {
onPage: 6,
onLoadMore: 2
}
}
}

View File

@ -1,43 +1,10 @@
require('dotenv').config() require('dotenv').config()
const siteConfig = require('./config')
module.exports = { module.exports = {
siteMetadata: { siteMetadata: {
title: 'devthread.ru', ...siteConfig
keywords: 'веб разработка, javascript, seo, программирование, reactjs, graphql',
siteName: 'Cборник статей и руководств - devthread.ru',
titleTemplate: '%s · статьи и руководства по веб-разработке',
description: 'Cборник статей и руководств по тематике веб-разработки и IT для того чтобы помочь вам',
url: 'https://devthread.netlify.app',
menuLinks: [
{
name: 'Статьи',
link: '/articles'
},
{
name: 'О сайте',
link: '/about'
},
{
name: 'Контакты',
link: '/contacts'
},
{
name: 'Сниппеты',
link: '/snippets'
}
],
social: {
email: 'support@devthread.ru',
telegram: 'https://t.me/devthread',
twitter: 'https://twitter.com/devthread',
yadzen: 'https://zen.yandex.ru/'
},
options: {
articles: {
onPage: 6,
onLoadMore: 2
}
}
}, },
plugins: [ plugins: [
'gatsby-plugin-react-helmet', 'gatsby-plugin-react-helmet',
@ -142,6 +109,12 @@ module.exports = {
], ],
}, },
}, },
{
resolve: `gatsby-plugin-disqus`,
options: {
shortname: `devthread`
}
},
{ {
resolve: 'gatsby-plugin-react-svg', resolve: 'gatsby-plugin-react-svg',
options: { options: {

5
package-lock.json generated
View File

@ -9071,6 +9071,11 @@
"micromatch": "^3.1.10" "micromatch": "^3.1.10"
} }
}, },
"gatsby-plugin-disqus": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gatsby-plugin-disqus/-/gatsby-plugin-disqus-1.2.0.tgz",
"integrity": "sha512-1Vgifach9KOCTKWmOESHbGDEAVxLwg7uJZbSyohQzBqqDzfnl42SOWJhIPCOCAtKi1GcqU4JIQiWBZmN1V0Zlg=="
},
"gatsby-plugin-firebase": { "gatsby-plugin-firebase": {
"version": "0.2.0-beta.4", "version": "0.2.0-beta.4",
"resolved": "https://registry.npmjs.org/gatsby-plugin-firebase/-/gatsby-plugin-firebase-0.2.0-beta.4.tgz", "resolved": "https://registry.npmjs.org/gatsby-plugin-firebase/-/gatsby-plugin-firebase-0.2.0-beta.4.tgz",

View File

@ -21,6 +21,7 @@
"firebase": "^7.16.0", "firebase": "^7.16.0",
"gatsby": "^2.23.12", "gatsby": "^2.23.12",
"gatsby-image": "^2.4.12", "gatsby-image": "^2.4.12",
"gatsby-plugin-disqus": "^1.2.0",
"gatsby-plugin-firebase": "^0.2.0-beta.4", "gatsby-plugin-firebase": "^0.2.0-beta.4",
"gatsby-plugin-manifest": "^2.4.17", "gatsby-plugin-manifest": "^2.4.17",
"gatsby-plugin-netlify-cms": "^4.3.9", "gatsby-plugin-netlify-cms": "^4.3.9",

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Disqus, CommentCount } from 'gatsby-plugin-disqus'
import SEO from '../SEO/SEO' import SEO from '../SEO/SEO'
import Img from "gatsby-image" import Img from "gatsby-image"
import ViewCounter from '../ViewCounter/ViewCounter' import ViewCounter from '../ViewCounter/ViewCounter'
@ -17,6 +18,14 @@ const Article = ({ data: { slug, keywords, title, image, description, category,
const { siteMetadata: { siteUrl } } = useSiteMetadataQuery() const { siteMetadata: { siteUrl } } = useSiteMetadataQuery()
const { pathname } = useLocation() const { pathname } = useLocation()
console.log(siteUrl+pathname)
let disqusConfig = {
url: `${siteUrl+pathname}`,
identifier: slug,
title: title,
}
return ( return (
<> <>
<SEO title={title} titleTemplate={false} keywords={keywords.join(', ')} description={description} image={`${siteUrl}${image.childImageSharp.fluid.src}`} type='article' /> <SEO title={title} titleTemplate={false} keywords={keywords.join(', ')} description={description} image={`${siteUrl}${image.childImageSharp.fluid.src}`} type='article' />
@ -81,6 +90,7 @@ const Article = ({ data: { slug, keywords, title, image, description, category,
<h2>Комментарии</h2> <h2>Комментарии</h2>
</div> </div>
<div className="article-comments__content"> <div className="article-comments__content">
<Disqus config={disqusConfig} />
</div> </div>
</div> </div>
</article> </article>

View File

@ -7,11 +7,11 @@ const Subscription = () => {
<div style={pathname !== '/about' && pathname !== '/about/' ? { height: '100%' } : null}> <div style={pathname !== '/about' && pathname !== '/about/' ? { height: '100%' } : null}>
<div style={pathname !== '/about' && pathname !== '/about/' ? { position: 'sticky', top: 75 } : null} className="offers-subscription offer-box"> <div style={pathname !== '/about' && pathname !== '/about/' ? { position: 'sticky', top: 75 } : null} className="offers-subscription offer-box">
<div className="offers-subscription__heading offer-heading"> <div className="offers-subscription__heading offer-heading">
Читайте нас в Telegram Канал в Telegram
</div> </div>
<div className="offers-subscription__content"> <div className="offers-subscription__content">
<p> <p>
В нашем канале telegram вы не пропустите новые статьи, присоединяйтесь к другим разработчикам В нашем канале telegram вы не пропустите статьи и новости, присоединяйтесь к другим разработчикам
</p> </p>
<a href="https://t.me/devthread" rel='noreferrer' target="_blank" className="btn-primary">Подписаться</a> <a href="https://t.me/devthread" rel='noreferrer' target="_blank" className="btn-primary">Подписаться</a>
</div> </div>

View File

@ -1,14 +1,15 @@
backend: backend:
name: github name: github
repo: sergeyyarkov/devthread.ru repo: sergeyyarkov/devthread.ru
media_folder: static/assets locale: 'ru'
public_folder: /assets media_folder: "static/images/uploads"
public_folder: "/images/uploads"
collections: collections:
- name: "articles" - name: "articles"
label: "Article" label: "Article"
folder: "content/articles" folder: "content/articles"
create: true create: true
slug: "{{slug}}" slug: "{{year}}-{{month}}-{{day}}_{{slug}}"
fields: fields:
- {label: "Template Key", name: "templateKey", wisdget: "hidden", default: "article"} - {label: "Template Key", name: "templateKey", wisdget: "hidden", default: "article"}
- {label: "Slug", name: "slug", widget: "string"} - {label: "Slug", name: "slug", widget: "string"}
@ -26,7 +27,7 @@ collections:
label: "Snippet" label: "Snippet"
folder: 'content/snippets' folder: 'content/snippets'
create: true create: true
slug: "{{slug}}" slug: "{{year}}-{{month}}-{{day}}_{{slug}}"
fields: fields:
- {label: "Template key", name: "templateKey", widget: "hidden", default: "snippet"} - {label: "Template key", name: "templateKey", widget: "hidden", default: "snippet"}
- {label: "Slug", name: "slug", widget: "string"} - {label: "Slug", name: "slug", widget: "string"}