WIP: seo, slider fix

This commit is contained in:
Sergejs Kozinecs 2022-08-08 00:22:18 +03:00
parent 72c02db378
commit 2d8ec6a213
7 changed files with 77 additions and 27 deletions

View file

@ -1,7 +1,8 @@
module.exports = { module.exports = {
siteMetadata: { siteMetadata: {
siteUrl: "https://www.yourdomain.tld", siteUrl: "https://www.midcreative.eu",
title: "MID Creative", title: "MID Creative",
description: "We are creating websites, mobile apps, e-shops, platforms",
}, },
plugins: [ plugins: [
"gatsby-plugin-sass", "gatsby-plugin-sass",

View file

@ -44,7 +44,6 @@ const MidHeader = () => {
}; };
document.addEventListener("click", outsideClickListener); document.addEventListener("click", outsideClickListener);
} }
}
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
document document
@ -54,6 +53,7 @@ const MidHeader = () => {
.getElementsByClassName("mobile-menu")[0] .getElementsByClassName("mobile-menu")[0]
.classList.remove("open"); .classList.remove("open");
}); });
}
}; };
return ( return (

View file

@ -27,6 +27,10 @@ header {
margin-left: 0; margin-left: 0;
} }
} }
@include for-mobile {
display: none;
}
} }
.mobile-menu-btn { .mobile-menu-btn {

25
src/components/seo.jsx Normal file
View file

@ -0,0 +1,25 @@
import React from "react";
import { useSiteMetadata } from "../hooks/use-site-metadata";
export const SEO = ({ title, description, pathname, children }) => {
const {
title: defaultTitle,
description: defaultDescription,
siteUrl,
} = useSiteMetadata();
const seo = {
title: title || defaultTitle,
description: description || defaultDescription,
url: `${siteUrl}${pathname || ``}`,
};
return (
<>
<title>{seo.title}</title>
<meta name="description" content={seo.description} />
<meta name="image" content={seo.image} />
{children}
</>
);
};

View file

@ -21,26 +21,12 @@ const ProjectsSwiper = () => {
const projects = t("projects", { returnObjects: true }); const projects = t("projects", { returnObjects: true });
const swiperProjects = projects.map((project, i) => ( // const swiperProjects = ;
<SwiperSlide key={`swiper-${i}`}>
<h2>{project.title}</h2>
<div className="img-wrap">
<img src={getImage(project.image)} alt="inflid" />
</div>
<div className="project-info">
<div>
{project.info.map((info, i) => (
<p key={`slide-info-${i}`}>{info}</p>
))}
</div>
<p>{project.text}</p>
</div>
</SwiperSlide>
));
return ( return (
<Swiper <Swiper
loop={true} loop={true}
loopAdditionalSlides={5}
autoplay={{ autoplay={{
delay: 2500, delay: 2500,
disableOnInteraction: true, disableOnInteraction: true,
@ -75,7 +61,23 @@ const ProjectsSwiper = () => {
id={`active-slide-${activeSlide}`} id={`active-slide-${activeSlide}`}
key={`our-swiper`} key={`our-swiper`}
> >
{projects && swiperProjects} {projects &&
projects.map((project, i) => (
<SwiperSlide key={`swiper-${i}`}>
<h2>{project.title}</h2>
<div className="img-wrap">
<img src={getImage(project.image)} alt="inflid" />
</div>
<div className="project-info">
<div>
{project.info.map((info, i) => (
<p key={`slide-info-${i}`}>{info}</p>
))}
</div>
<p>{project.text}</p>
</div>
</SwiperSlide>
))}
</Swiper> </Swiper>
); );
}; };

View file

@ -0,0 +1,15 @@
import { graphql, useStaticQuery } from "gatsby";
export const useSiteMetadata = () => {
const data = useStaticQuery(graphql`
query {
site {
siteMetadata {
title
description
siteUrl
}
}
}
`);
return data.site.siteMetadata;
};

View file

@ -1,4 +1,5 @@
import * as React from "react"; import * as React from "react";
import { SEO } from "../components/seo";
import "../assets/stylesheets/style.scss"; import "../assets/stylesheets/style.scss";
@ -9,3 +10,5 @@ const IndexPage = () => {
}; };
export default IndexPage; export default IndexPage;
export const Head = () => <SEO />;