Skip to content
This repository was archived by the owner on Nov 11, 2023. It is now read-only.
/ freesewing.org Public archive

Commit 1b9f78e

Browse files
committed
fix: Remove duplication of pages
Closes freesewing/freesewing#1774
1 parent 42939f9 commit 1b9f78e

File tree

2 files changed

+0
-174
lines changed

2 files changed

+0
-174
lines changed

gatsby-node.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,6 @@ const createMdxPages = async function (pages, createPage, graphql, language) {
168168
file: page.node.fileAbsolutePath,
169169
},
170170
}
171-
// Handle duplicates in docs
172-
if (type === 'docs' && typeof routes.duplicates[slug] !== 'undefined') {
173-
for (let newSlug of routes.duplicates[slug]) {
174-
pages[type][newSlug] = {
175-
path: newSlug,
176-
component,
177-
context: {
178-
slug: newSlug,
179-
title: pages.docs[slug].context.title,
180-
order: pages.docs[slug].context.order,
181-
// Keep file here, it is used in the page query to filter
182-
file: pages.docs[slug].context.file,
183-
},
184-
}
185-
}
186-
}
187171
}
188172
}
189173
for (let slug in pages[type]) {

gatsby-routes.js

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,161 +1,4 @@
11
const patterns = require('@freesewing/pattern-info').list
2-
const options = require('@freesewing/pattern-info').options
3-
4-
const addDupe = (option, from, to) => {
5-
let slug = `/docs/patterns/${from}/options/${option.toLowerCase()}/`
6-
if (!patternOptions[slug]) patternOptions[slug] = { find: from, replace: [to] }
7-
else patternOptions[slug].replace.push(to)
8-
}
9-
10-
// this will be populated by addDupe()
11-
const patternOptions = {}
12-
13-
const dupes = {
14-
brian: [
15-
{
16-
options: [
17-
'sleevecapbackfactorx',
18-
'sleevecapbackfactory',
19-
'sleevecapease',
20-
'sleevecapfrontfactorx',
21-
'sleevecapfrontfactory',
22-
'sleevecapq1offset',
23-
'sleevecapq1spread1',
24-
'sleevecapq1spread2',
25-
'sleevecapq2offset',
26-
'sleevecapq2spread1',
27-
'sleevecapq2spread2',
28-
'sleevecapq3offset',
29-
'sleevecapq3spread1',
30-
'sleevecapq3spread2',
31-
'sleevecapq4offset',
32-
'sleevecapq4spread1',
33-
'sleevecapq4spread2',
34-
'sleevecaptopfactorx',
35-
'sleevecaptopfactory',
36-
'sleevewidthguarantee',
37-
],
38-
to: ['huey', 'simon', 'simone', 'sven', 'diana', 'teagan'],
39-
},
40-
{
41-
options: ['backneckcutout', 'frontarmholedeeper', 'shoulderslopereduction'],
42-
to: ['bent', 'carlita', 'carlton', 'huey', 'hugo', 'jaeger', 'simon', 'sven'],
43-
},
44-
{
45-
options: ['sleevelengthbonus'],
46-
to: ['huey', 'hugo'],
47-
},
48-
{
49-
options: ['sleevecapheight'],
50-
to: ['carlita', 'carlton', 'jaeger'],
51-
},
52-
{
53-
options: ['acrossbackfactor'],
54-
to: ['bent', 'diana', 'huey', 'hugo', 'teagan'],
55-
},
56-
{
57-
options: ['armholedepthfactor'],
58-
to: ['bent', 'huey', 'sven', 'wahid', 'teagan'],
59-
},
60-
{
61-
options: ['acrossbackfactor'],
62-
to: ['bent', 'diana', 'huey', 'hugo', 'teagan'],
63-
},
64-
{
65-
options: ['bicepsease'],
66-
to: ['bent', 'huey', 'hugo', 'jaeger'],
67-
},
68-
{
69-
options: ['chestease', 'cuffease', 'lengthbonus'],
70-
to: ['bent', 'huey', 'hugo'],
71-
},
72-
{
73-
options: ['collarease'],
74-
to: ['bent', 'huey', 'jaeger', 'sven'],
75-
},
76-
{
77-
options: ['shoulderease'],
78-
to: ['bent', 'huey', 'jaeger', 'simon'],
79-
},
80-
],
81-
huey: [
82-
{
83-
options: ['ribbingheight'],
84-
to: ['hugo'],
85-
},
86-
],
87-
carlita: [
88-
{
89-
options: [
90-
'frontoverlap',
91-
'pocketradius',
92-
'innerpocketdepth',
93-
'innerpocketplacement',
94-
'innerpocketweltheight',
95-
'innerpocketwidth',
96-
'lapelreduction',
97-
],
98-
to: ['carlton', 'jaeger'],
99-
},
100-
],
101-
titan: [
102-
{
103-
options: [
104-
'waistease',
105-
'seatease',
106-
'kneeease',
107-
'waistheight',
108-
'lengthbonus',
109-
'crotchdrop',
110-
'crossseamcurvestart',
111-
'crossseamcurvebend',
112-
'crossseamcurveangle',
113-
'crotchseamcurvestart',
114-
'crotchseamcurvebend',
115-
'crotchseamcurveangle',
116-
'grainlineposition',
117-
'legbalance',
118-
'waistbalance',
119-
'waistbandwidth',
120-
],
121-
to: ['paco', 'charlie'],
122-
},
123-
],
124-
}
125-
126-
for (let from in dupes) {
127-
for (let set of dupes[from]) {
128-
for (let to of set.to) {
129-
for (let option of set.options) addDupe(option, from, to)
130-
}
131-
}
132-
}
133-
134-
// Breanna inherits almost all options from Brian
135-
for (let option of options.brian) {
136-
if (['lengthBonus', 'sleeveWidthGuarantee'].indexOf(option) === -1)
137-
addDupe(option, 'brian', 'breanna')
138-
}
139-
140-
// Carton inherits almost all options from Carlita
141-
for (let option of options.carlita) {
142-
if (option !== 'contour') addDupe(option, 'carlita', 'carlton')
143-
}
144-
145-
// Simone inherits all options from Simon
146-
for (let option of options.simon) addDupe(option, 'simon', 'simone')
147-
148-
const getDuplicates = () => {
149-
let dupes = {}
150-
for (let slug in patternOptions) {
151-
dupes[slug] = []
152-
for (let insert of patternOptions[slug].replace) {
153-
dupes[slug].push(slug.replace(patternOptions[slug].find, insert))
154-
}
155-
}
156-
157-
return dupes
158-
}
1592

1603
/* This matches a route pattern with the page component */
1614
const routes = {
@@ -211,7 +54,6 @@ const routes = {
21154
'/patterns/:pattern/save-as': 'patterns/_pattern/save-as.js',
21255
'/recreate/gist/:gist': 'recreate/gist/_gist.js',
21356
},
214-
duplicates: getDuplicates(),
21557
redirects: {
21658
'/recreate/': '/create/',
21759
'/contact/': '/docs/about/contact/',

0 commit comments

Comments
 (0)