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()
const siteConfig = require('./config')
module.exports = {
siteMetadata: {
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
}
}
...siteConfig
},
plugins: [
'gatsby-plugin-react-helmet',
@ -142,6 +109,12 @@ module.exports = {
],
},
},
{
resolve: `gatsby-plugin-disqus`,
options: {
shortname: `devthread`
}
},
{
resolve: 'gatsby-plugin-react-svg',
options: {

5
package-lock.json generated
View File

@ -9071,6 +9071,11 @@
"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": {
"version": "0.2.0-beta.4",
"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",
"gatsby": "^2.23.12",
"gatsby-image": "^2.4.12",
"gatsby-plugin-disqus": "^1.2.0",
"gatsby-plugin-firebase": "^0.2.0-beta.4",
"gatsby-plugin-manifest": "^2.4.17",
"gatsby-plugin-netlify-cms": "^4.3.9",

View File

@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types'
import { Disqus, CommentCount } from 'gatsby-plugin-disqus'
import SEO from '../SEO/SEO'
import Img from "gatsby-image"
import ViewCounter from '../ViewCounter/ViewCounter'
@ -17,6 +18,14 @@ const Article = ({ data: { slug, keywords, title, image, description, category,
const { siteMetadata: { siteUrl } } = useSiteMetadataQuery()
const { pathname } = useLocation()
console.log(siteUrl+pathname)
let disqusConfig = {
url: `${siteUrl+pathname}`,
identifier: slug,
title: title,
}
return (
<>
<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>
</div>
<div className="article-comments__content">
<Disqus config={disqusConfig} />
</div>
</div>
</article>

View File

@ -7,11 +7,11 @@ const Subscription = () => {
<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 className="offers-subscription__heading offer-heading">
Читайте нас в Telegram
Канал в Telegram
</div>
<div className="offers-subscription__content">
<p>
В нашем канале telegram вы не пропустите новые статьи, присоединяйтесь к другим разработчикам
В нашем канале telegram вы не пропустите статьи и новости, присоединяйтесь к другим разработчикам
</p>
<a href="https://t.me/devthread" rel='noreferrer' target="_blank" className="btn-primary">Подписаться</a>
</div>

View File

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