mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 10:19:13 +03:00
tag collection
This commit is contained in:
parent
3b44c7c702
commit
2c2dc313c2
@ -10,7 +10,7 @@ import VkIcon from '../../images/vk-icon.svg'
|
|||||||
import TwitterIcon from '../../images/twitter-icon__large.svg'
|
import TwitterIcon from '../../images/twitter-icon__large.svg'
|
||||||
import FacebookIcon from '../../images/facebook-icon__large.svg'
|
import FacebookIcon from '../../images/facebook-icon__large.svg'
|
||||||
|
|
||||||
const Article = ({ data: { title, image, description, category, tags, time, date }, html }) => {
|
const Article = ({ data: { slug, title, image, description, category, tags, time, date }, html }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SEO title={title} description={description} />
|
<SEO title={title} description={description} />
|
||||||
@ -41,13 +41,13 @@ const Article = ({ data: { title, image, description, category, tags, time, date
|
|||||||
<div className="article-share">
|
<div className="article-share">
|
||||||
<span>Поделиться:</span>
|
<span>Поделиться:</span>
|
||||||
<div className="article-share__social">
|
<div className="article-share__social">
|
||||||
<a href="/">
|
<a href={`/article/${slug}`}>
|
||||||
<VkIcon />
|
<VkIcon />
|
||||||
</a>
|
</a>
|
||||||
<a href="/">
|
<a href={`/article/${slug}`}>
|
||||||
<TwitterIcon />
|
<TwitterIcon />
|
||||||
</a>
|
</a>
|
||||||
<a href="/">
|
<a href={`/article/${slug}`}>
|
||||||
<FacebookIcon />
|
<FacebookIcon />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -59,7 +59,7 @@ const Article = ({ data: { title, image, description, category, tags, time, date
|
|||||||
</div>
|
</div>
|
||||||
<div className="article-tags">
|
<div className="article-tags">
|
||||||
{tags.map((tag, i) => <div key={i} className="tag-item">
|
{tags.map((tag, i) => <div key={i} className="tag-item">
|
||||||
<Link to={`category/${tag}`}>{tag}</Link>
|
<Link to={`/tag/${slugify(tag)}`}>{tag}</Link>
|
||||||
</div>)}
|
</div>)}
|
||||||
</div>
|
</div>
|
||||||
<div className="article-image">
|
<div className="article-image">
|
||||||
|
|||||||
@ -43,7 +43,7 @@ const IndexPage = ({ data: { allMarkdownRemark: edges } }) => {
|
|||||||
|
|
||||||
export const query = graphql`
|
export const query = graphql`
|
||||||
{
|
{
|
||||||
allMarkdownRemark(filter: {frontmatter: {templateKey: {eq: "article"}}}, sort: {order: DESC, fields: frontmatter___date}) {
|
allMarkdownRemark(filter: {frontmatter: {templateKey: {eq: "article"}}}, sort: {order: DESC, fields: frontmatter___date}, limit: 10) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
frontmatter {
|
frontmatter {
|
||||||
|
|||||||
@ -10,16 +10,16 @@ collections:
|
|||||||
create: true
|
create: true
|
||||||
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
|
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
|
||||||
fields:
|
fields:
|
||||||
- {label: "Template Key", name: "templateKey", widget: "hidden", default: "article"}
|
- {label: "Template Key", name: "templateKey", wisdget: "hidden", default: "article"}
|
||||||
- {label: "Slug", name: "slug", widget: "string"}
|
- {label: "Slug", name: "slug", widget: "string"}
|
||||||
- {label: "Время чтения", name: "time", widget: "string"}
|
- {label: "Время чтения", name: "time", widget: "string"}
|
||||||
- {label: "Заголовок", name: "title", widget: "string"}
|
- {label: "Заголовок", name: "title", widget: "string"}
|
||||||
- {label: "Обложка", name: "image", widget: "image"}
|
- {label: "Обложка", name: "image", widget: "image"}
|
||||||
- {label: "Категория", name: "category", widget: "relation", collection: "categories", valueField: "title", searchFields: ["title", "slug"]}
|
- {label: "Категория", name: "category", widget: "relation", collection: "categories", valueField: "title", searchFields: ["title"]}
|
||||||
- {label: "Дата публикации", name: "date", widget: "datetime"}
|
- {label: "Дата публикации", name: "date", widget: "datetime"}
|
||||||
- {label: "Описание", name: "description", widget: "text"}
|
- {label: "Описание", name: "description", widget: "text"}
|
||||||
- {label: "Содержание", name: "body", widget: "markdown"}
|
- {label: "Содержание", name: "body", widget: "markdown"}
|
||||||
- {label: "Тэги", name: "tags", widget: "list"}
|
- {label: "Тэги", name: "tags", widget: "relation", multiple: true, collection: "tags", valueField: "title", searchFields: ["title"]}
|
||||||
- name: 'categories'
|
- name: 'categories'
|
||||||
label: "Category"
|
label: "Category"
|
||||||
folder: 'content/categories'
|
folder: 'content/categories'
|
||||||
@ -28,3 +28,11 @@ collections:
|
|||||||
fields:
|
fields:
|
||||||
- {label: "Template key", name: "templateKey", widget: "hidden", default: "category"}
|
- {label: "Template key", name: "templateKey", widget: "hidden", default: "category"}
|
||||||
- {label: "Название категории", name: "title", widget: "string"}
|
- {label: "Название категории", name: "title", widget: "string"}
|
||||||
|
- name: 'tags'
|
||||||
|
label: "Tag"
|
||||||
|
folder: 'content/tags'
|
||||||
|
create: true
|
||||||
|
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
|
||||||
|
fields:
|
||||||
|
- {label: "Template key", name: "templateKey", widget: "hidden", default: "tag"}
|
||||||
|
- {label: "Название тэга", name: "title", widget: "string"}
|
||||||
Loading…
x
Reference in New Issue
Block a user