Skip to content

Commit

Permalink
Feat(SEO): generated seo tags and structure data from libraries (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deokumarjnu authored Jul 23, 2021
1 parent 932462b commit fd75141
Show file tree
Hide file tree
Showing 2 changed files with 4,909 additions and 2,496 deletions.
30 changes: 16 additions & 14 deletions app/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { generateRoutes, STATIC_ROUTES } from "./routes";
import { renderLayout } from "./handlers/render-layout";
import { loadData, loadErrorData } from "./load-data";
import { pickComponent } from "../isomorphic/pick-component";
import { SEO } from "@quintype/seo";
import { generateStaticData, generateStructuredData, SEO } from "@quintype/seo";
import { Collection } from "@quintype/framework/server/api-client";
export const app = createApp();

Expand Down Expand Up @@ -73,14 +73,22 @@ getWithConfig(app, "/collection/:collectionSlug", redirectCollectionHandler(), {
logError
});

ampRoutes(app, {
seo: new SEO({
staticTags: STATIC_TAGS,
function generateSeo(config, pageType) {
return new SEO({
staticTags: Object.assign(generateStaticData(config)),
structuredData: Object.assign(generateStructuredData(config), {
enableLiveBlog: true,
enableVideo: true,
enableNewsArticle: true
}),
enableTwitterCards: true,
enableOgTags: true,
enableNews: true,
structuredData: STRUCTURED_DATA
})
enableNews: true
});
}

ampRoutes(app, {
seo: generateSeo
});

isomorphicRoutes(app, {
Expand All @@ -93,13 +101,7 @@ isomorphicRoutes(app, {
templateOptions: true,
loadErrorData: loadErrorData,
staticRoutes: STATIC_ROUTES,
seo: new SEO({
staticTags: STATIC_TAGS,
enableTwitterCards: true,
enableOgTags: true,
enableNews: true,
structuredData: STRUCTURED_DATA
}),
seo: generateSeo,
preloadJs: true,
prerenderServiceUrl: "https://prerender.quintype.io"
});
Loading

0 comments on commit fd75141

Please sign in to comment.