mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 10:19:13 +03:00
pathname to view counter
This commit is contained in:
parent
dc739b064d
commit
dd773ee474
@ -6,6 +6,7 @@ import ViewCounter from '../ViewCounter/ViewCounter'
|
||||
import useSiteMetadataQuery from '../../hooks/useSiteMetadataQuery'
|
||||
import slugify from '../../helpers/slugify'
|
||||
import { Link } from 'gatsby'
|
||||
import { useLocation } from '@reach/router'
|
||||
|
||||
import ViewsIcon from '../../images/views-icon.svg'
|
||||
import VkIcon from '../../images/vk-icon.svg'
|
||||
@ -14,6 +15,8 @@ import FacebookIcon from '../../images/facebook-icon__large.svg'
|
||||
|
||||
const Article = ({ data: { slug, keywords, title, image, description, category, tags, time, date }, html }) => {
|
||||
const { siteMetadata: { siteUrl } } = useSiteMetadataQuery()
|
||||
const { pathname } = useLocation()
|
||||
|
||||
return (
|
||||
<>
|
||||
<SEO title={title} titleTemplate={false} keywords={keywords.join(', ')} description={description} image={`${siteUrl}${image.childImageSharp.fluid.src}`} type='article' />
|
||||
@ -26,7 +29,7 @@ const Article = ({ data: { slug, keywords, title, image, description, category,
|
||||
</div>
|
||||
<div className="article-info__views">
|
||||
<ViewsIcon />
|
||||
<ViewCounter id={slug} />
|
||||
<ViewCounter id={pathname} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="right-info">
|
||||
|
||||
@ -26,7 +26,7 @@ collections:
|
||||
label: "Category"
|
||||
folder: 'content/categories'
|
||||
create: true
|
||||
slug: "{{year}}-{{month}}-{{day}}"
|
||||
slug: "{{slug}}"
|
||||
fields:
|
||||
- {label: "Template key", name: "templateKey", widget: "hidden", default: "category"}
|
||||
- {label: "Название категории", name: "title", widget: "string"}
|
||||
@ -34,7 +34,7 @@ collections:
|
||||
label: "Tag"
|
||||
folder: 'content/tags'
|
||||
create: true
|
||||
slug: "{{year}}-{{month}}-{{day}}"
|
||||
slug: "{{slug}}"
|
||||
fields:
|
||||
- {label: "Template key", name: "templateKey", widget: "hidden", default: "tag"}
|
||||
- {label: "Название тэга", name: "title", widget: "string"}
|
||||
@ -42,7 +42,7 @@ collections:
|
||||
label: "Book"
|
||||
folder: 'content/books'
|
||||
create: true
|
||||
slug: "{{year}}-{{month}}-{{day}}"
|
||||
slug: "{{slug}}"
|
||||
fields:
|
||||
- {label: "Template key", name: "templateKey", widget: "hidden", default: "book"}
|
||||
- {label: "Название книги", name: "title", widget: "string"}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user