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 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 (
|
||||
<>
|
||||
<SEO title={title} description={description} />
|
||||
@ -41,13 +41,13 @@ const Article = ({ data: { title, image, description, category, tags, time, date
|
||||
<div className="article-share">
|
||||
<span>Поделиться:</span>
|
||||
<div className="article-share__social">
|
||||
<a href="/">
|
||||
<a href={`/article/${slug}`}>
|
||||
<VkIcon />
|
||||
</a>
|
||||
<a href="/">
|
||||
<a href={`/article/${slug}`}>
|
||||
<TwitterIcon />
|
||||
</a>
|
||||
<a href="/">
|
||||
<a href={`/article/${slug}`}>
|
||||
<FacebookIcon />
|
||||
</a>
|
||||
</div>
|
||||
@ -59,7 +59,7 @@ const Article = ({ data: { title, image, description, category, tags, time, date
|
||||
</div>
|
||||
<div className="article-tags">
|
||||
{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 className="article-image">
|
||||
|
||||
@ -43,7 +43,7 @@ const IndexPage = ({ data: { allMarkdownRemark: edges } }) => {
|
||||
|
||||
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 {
|
||||
node {
|
||||
frontmatter {
|
||||
|
||||
@ -10,16 +10,16 @@ collections:
|
||||
create: true
|
||||
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
|
||||
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: "Время чтения", name: "time", widget: "string"}
|
||||
- {label: "Заголовок", name: "title", widget: "string"}
|
||||
- {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: "description", widget: "text"}
|
||||
- {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'
|
||||
label: "Category"
|
||||
folder: 'content/categories'
|
||||
@ -28,3 +28,11 @@ collections:
|
||||
fields:
|
||||
- {label: "Template key", name: "templateKey", widget: "hidden", default: "category"}
|
||||
- {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