import React from "react" import { FormattedMessage, FormattedHTMLMessage, Link, useIntl, injectIntl } from "gatsby-plugin-intl" import { graphql } from "gatsby" import Layout from "../components/layout" import SEO from "../components/seo" import head from "../images/index/head.png" import "../styles/main.css" import "../styles/bootstrap.min.css" import {Jumbotron, Button} from "react-bootstrap" const IndexPage = ({ data }) => { const intl = useIntl() const lang = intl.locale var news = "" if ( lang==="ru" ) { news = data.ru_posts.edges; } else if ( lang==="en" ) { news = data.en_posts.edges; } return( {/* --------------------------------- */} head

{/* ------------------------------ */}


{/* --------------------------------- */}

{ news.map(({node}) => { const title = node.frontmatter.title; const date = node.frontmatter.date; console.log() return (

{title}{date}

) })}
) } export default injectIntl(IndexPage) export const query = graphql` query { ru_posts: allMarkdownRemark(filter: {frontmatter: {content_type: {eq: "post"}, published: {eq: true}, language: {eq: "ru"}}}, sort: {fields: [frontmatter___date], order: DESC}, limit: 3 ) { edges{ node{ html frontmatter { date(formatString: "DD.MM.YYYY") title language } } } } en_posts: allMarkdownRemark(filter: {frontmatter: {content_type: {eq: "post"}, published: {eq: true}, language: {eq: "en"}}}, sort: {fields: [frontmatter___date], order: DESC}, limit: 3 ) { edges{ node{ html frontmatter { date(formatString: "DD.MM.YYYY") title language } } } } }`