Skip to content

Commit ed66135

Browse files
Merge pull request #260 from bitlogic/dev
Release 19-06-2024
2 parents 3a3a55e + 01ea359 commit ed66135

File tree

96 files changed

+8927
-24030
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+8927
-24030
lines changed

gatsby-config.js

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,73 @@ module.exports = {
33
title: `Bitlogic`,
44
description: `Bitlogic Web es una empresa dedicada al diseño, ingeniería y desarrollo ágil de productos de software, especializada en la transformación digital de instituciones educativas .`,
55
author: `Bitlogic.io`,
6-
siteUrl: process.env.SITE_URL,
6+
siteUrl: process.env.SITE_URL,
7+
// siteUrl: 'https://bitlogic.io',
78
},
89
plugins: [
9-
`gatsby-plugin-sitemap`,
10+
{
11+
resolve: `gatsby-plugin-sitemap`,
12+
options: {
13+
output: '/',
14+
query: `
15+
{
16+
allSitePage {
17+
nodes {
18+
path
19+
pageContext
20+
}
21+
}
22+
strapiBlogPage {
23+
updated_at
24+
}
25+
strapiHome {
26+
updated_at
27+
}
28+
}
29+
`,
30+
resolveSiteUrl: () => process.env.SITE_URL,
31+
resolvePages: ({
32+
allSitePage: { nodes: allPages },
33+
strapiBlogPage: blogPage,
34+
strapiHome: homePage
35+
}) => {
36+
const singlePages = [
37+
{
38+
path: '/',
39+
lastmod: homePage.updated_at
40+
},
41+
{
42+
path: '/blog',
43+
lastmod: blogPage.updated_at
44+
}
45+
];
46+
47+
return allPages.map(page => {
48+
if (page.path === '/') return singlePages[0]
49+
else if (page.path === '/blog/') return singlePages[1]
50+
51+
return {
52+
path: page.path,
53+
lastmod: page?.pageContext?.lastmod
54+
}
55+
})
56+
},
57+
serialize: ({ path, lastmod }) => {
58+
return {
59+
url: path,
60+
lastmod: lastmod,
61+
}
62+
},
63+
}
64+
},
65+
{
66+
resolve: 'gatsby-plugin-robots-txt',
67+
options: {
68+
host: process.env.SITE_URL,
69+
sitemap: `${process.env.SITE_URL}/sitemap-index.xml`,
70+
policy: [{ userAgent: '*', allow: '/' }]
71+
}
72+
},
1073
{
1174
resolve: `gatsby-plugin-google-gtag`,
1275
options: {
@@ -32,6 +95,7 @@ module.exports = {
3295
{
3396
resolve: `gatsby-plugin-canonical-urls`,
3497
options: {
98+
// siteUrl: 'https://bitlogic.io',
3599
siteUrl: process.env.SITE_URL,
36100
},
37101
},
@@ -41,6 +105,7 @@ module.exports = {
41105
// apiURL: `http://lb-bitlogic-strapi-dev-48805770.sa-east-1.elb.amazonaws.com:1337`,
42106
// apiURL: `https://strapi.bitlogic.io`,
43107
apiURL: process.env.STRAPI_URL,
108+
// apiURL: 'http://127.0.0.1:1337',
44109
queryLimit: 1000,
45110
collectionTypes: [
46111
`article`,

gatsby-node.js

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require("path")
1+
const path = require("path");
22
const FilterWarningsPlugin = require("webpack-filter-warnings-plugin");
33

44
exports.onCreateWebpackConfig = ({ actions }) => {
@@ -32,7 +32,7 @@ exports.createSchemaCustomization = ({ actions }) => {
3232
homeSchema.value +
3333
iconSchema.value +
3434
landingSchema.value +
35-
layoutSchema.value +
35+
layoutSchema.value +
3636
professionalsSchema.value +
3737
generalSchema.value
3838
createTypes(typeDefs)
@@ -47,6 +47,7 @@ exports.createPages = async ({ graphql, actions }) => {
4747
allStrapiArticle {
4848
nodes {
4949
slug
50+
updated_at
5051
}
5152
}
5253
}
@@ -61,7 +62,10 @@ exports.createPages = async ({ graphql, actions }) => {
6162
createPage({
6263
path: "/blog/" + node.slug,
6364
component: BlogDetail,
64-
context: { slug: node.slug },
65+
context: {
66+
slug: node.slug,
67+
lastmod: node.updated_at
68+
},
6569
})
6670
})
6771

@@ -71,6 +75,10 @@ exports.createPages = async ({ graphql, actions }) => {
7175
allStrapiLandingPage {
7276
nodes {
7377
slug
78+
updated_at
79+
parent_page {
80+
slug
81+
}
7482
}
7583
}
7684
}
@@ -80,12 +88,33 @@ exports.createPages = async ({ graphql, actions }) => {
8088
reporter.panicOnBuild("Error creando paginas de landing")
8189
}
8290

83-
LandingQueryData.allStrapiLandingPage.nodes.forEach(node => {
91+
const landings = LandingQueryData.allStrapiLandingPage.nodes;
92+
93+
function getUrl(node) {
94+
if (!node) return ""
95+
96+
if (node.parent_page) {
97+
const parentPage = landings.find((landing) =>
98+
landing.slug === node.parent_page.slug
99+
)
100+
const parentUrl = getUrl(parentPage)
101+
return `${parentUrl}/${node.slug}`
102+
}
103+
104+
return `/${node.slug}`
105+
}
106+
107+
landings.forEach(node => {
84108
const LandingPage = path.resolve("./src/templates/LandingPage.js")
109+
const url = getUrl(node)
110+
85111
createPage({
86-
path: "/" + node.slug,
112+
path: url,
87113
component: LandingPage,
88-
context: { slug: node.slug },
114+
context: {
115+
slug: node.slug,
116+
lastmod: node.updated_at
117+
},
89118
})
90119
})
91120
}

0 commit comments

Comments
 (0)