Skip to content

Commit 3e9cf8c

Browse files
Merge pull request #288 from bitlogic/SBIT-391
SBIT-391: Modify URL generation for pages
2 parents 417bc98 + b55cb93 commit 3e9cf8c

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

gatsby-config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
module.exports = {
2+
trailingSlash: "always",
23
siteMetadata: {
34
title: `Bitlogic`,
45
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 .`,
56
author: `Bitlogic.io`,
67
siteUrl: process.env.SITE_URL,
7-
// siteUrl: "https://bitlogic.io",
8+
// siteUrl: "https://es.bitlogic.io",
89
},
910
plugins: [
1011
{
@@ -39,7 +40,7 @@ module.exports = {
3940
lastmod: homePage.updated_at,
4041
},
4142
{
42-
path: "/blog",
43+
path: "/blog/",
4344
lastmod: blogPage.updated_at,
4445
},
4546
]
@@ -88,8 +89,9 @@ module.exports = {
8889
{
8990
resolve: `gatsby-plugin-canonical-urls`,
9091
options: {
91-
// siteUrl: "https://bitlogic.io",
92+
stripQueryString: true,
9293
siteUrl: process.env.SITE_URL,
94+
// siteUrl: "https://es.bitlogic.io",
9395
},
9496
},
9597
{

src/components/Footer/Navegation/navegation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function Navegation({ title, items }) {
1313
content={navItem.label}
1414
url={
1515
navItem?.url ||
16-
(navItem?.singleType ? `/${navItem.singleType}` : "")
16+
(navItem?.singleType ? `/${navItem.singleType}/` : "")
1717
}
1818
landing={navItem?.landing}
1919
className=""

src/hooks/useLandingUrl.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
import { useMemo } from "react";
2-
import useNavbar from "./useNavbar";
1+
import { useMemo } from "react"
2+
import useNavbar from "./useNavbar"
33

44
const useLandingUrl = () => {
5-
const landings = useNavbar().allStrapiLandingPage.nodes;
5+
const landings = useNavbar().allStrapiLandingPage.nodes
66

77
const getUrl = useMemo(() => {
8-
const memoizedGetUrl = (slug) => {
9-
const landing = landings.find((node) => node.slug === slug);
8+
const memoizedGetUrl = slug => {
9+
const landing = landings.find(node => node.slug === slug)
1010

11-
if (!landing) return '';
11+
if (!landing) return ""
1212

1313
if (landing.parent_page) {
14-
const parentPage = landings.find((node) => node.slug === landing.parent_page.slug);
15-
const parentUrl = memoizedGetUrl(parentPage.slug); // Usamos la versión memoizada de getUrl
16-
return `${parentUrl}/${landing.slug}`;
14+
const parentPage = landings.find(
15+
node => node.slug === landing.parent_page.slug
16+
)
17+
const parentUrl = memoizedGetUrl(parentPage.slug) // Usamos la versión memoizada de getUrl
18+
return `${parentUrl}${landing.slug}/`
1719
}
1820

19-
return `/${landing.slug}`;
20-
};
21+
return `/${landing.slug}/`
22+
}
2123

22-
return memoizedGetUrl;
23-
}, [landings]);
24+
return memoizedGetUrl
25+
}, [landings])
2426

25-
return getUrl;
26-
};
27+
return getUrl
28+
}
2729

28-
export default useLandingUrl;
30+
export default useLandingUrl

0 commit comments

Comments
 (0)