diff --git a/src/components/templates/news.js b/src/components/templates/news.js index 428ffd9..ba0051c 100644 --- a/src/components/templates/news.js +++ b/src/components/templates/news.js @@ -1,38 +1,48 @@ import React from 'react' -import { Link, graphql } from 'gatsby' +import { graphql } from 'gatsby' +import { FormattedMessage, Link, useIntl, injectIntl } from "gatsby-plugin-intl" import { Timeline, TimelineItem } from 'vertical-timeline-component-for-react' import Header from "../header" import Footer from "../footer" -export default function(props) { - const news = props.data.news.edges.map(newsItem => newsItem.node) +const NewsTemplate = ( props ) => { + const intl = useIntl() + const lang = intl.locale + console.log(lang) + + var news = "" + if ( lang==="ru" ) { news = props.data.ru_news.edges} + else if ( lang==="en" ) { news = props.data.en_news.edges; } + const next = props.pageContext.next const prev = props.pageContext.prev + console.log(news) + return ( <>
{/*

Все новости

*/} - {news.map(newsItem => ( + {news.map(({node}) => ( -

{newsItem.frontmatter.title}

-

+

{node.frontmatter.title}

+

))}