Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ft/Removed hard coded content #246

Merged
merged 37 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7050428
Moved join us to cms
kelvinkipruto Sep 2, 2022
b525b4e
Merge branch 'main' into ft/remove-hard-coded-content
kelvinkipruto Sep 2, 2022
4cd1db3
Removed Console log
kelvinkipruto Sep 2, 2022
01edc86
Fixed failing test
kelvinkipruto Sep 2, 2022
b812a21
Separated joins us from contact
kelvinkipruto Sep 5, 2022
acec6d0
Moved hero slug to netlify
kelvinkipruto Sep 6, 2022
597f811
moved impact slug to netlify
kelvinkipruto Sep 6, 2022
d860dff
Moved get in touch slug to netlify
kelvinkipruto Sep 6, 2022
fd6a409
moved meet our team slug to netlify
kelvinkipruto Sep 6, 2022
e9b9ec1
refractored some slugs and titles
kelvinkipruto Sep 6, 2022
acd80a8
Merge branch 'main' into ft/remove-hard-coded-content
kelvinkipruto Sep 6, 2022
504f28c
Handle slug for file-based collections
kilemensi Sep 8, 2022
827c84a
Partially fixed hard coded slug
kelvinkipruto Sep 8, 2022
234308d
Get news-stories slug from cms
kelvinkipruto Sep 8, 2022
7c00296
Merge branch 'main' into ft/remove-hard-coded-content
kilemensi Sep 9, 2022
238c9b9
Pull slug + restructure to match component props
kilemensi Sep 9, 2022
a6b3560
Remove hard-coded our-partners
kilemensi Sep 9, 2022
b299bed
Add related project config and content to individual partner page
kilemensi Sep 9, 2022
d0e7871
Pull related projects from CMS
kilemensi Sep 9, 2022
1bdb570
Add related project config to our-work-individual
kilemensi Sep 9, 2022
8eb0347
Pull our-work-individual's related-projects from CMS
kilemensi Sep 9, 2022
fda66c6
add related-project to about-members-individual config
kilemensi Sep 9, 2022
b033d4e
pull about-members-individual's related-projects from CMS
kilemensi Sep 9, 2022
a430c47
Use id for matching instead of name
kilemensi Sep 9, 2022
652f54b
Add our-projects to index page
kilemensi Sep 9, 2022
e214ae8
Add ability to pull our-projects to CMS
kilemensi Sep 9, 2022
95021f0
Pull index's our-projects from CMS
kilemensi Sep 9, 2022
d865067
Fixed Join Us
kelvinkipruto Sep 9, 2022
3f85399
Add our-work config to /projects page
kilemensi Sep 9, 2022
94dd8d6
Pull projects from CMS
kilemensi Sep 9, 2022
4ea5818
Pull stories and opportunities from CMS
kilemensi Sep 9, 2022
318226f
Pull related news and stories from CMS
kilemensi Sep 9, 2022
4f7d32f
Pull team content from CMS
kilemensi Sep 9, 2022
5892963
Merge branch 'ft/remove-hard-coded-content' of github.com:CodeForAfri…
kilemensi Sep 9, 2022
f877a1b
Pull contact form from CMS
kilemensi Sep 9, 2022
0098e5d
Pull our offices from CMS
kilemensi Sep 9, 2022
9857764
Refractore some hard coded content
kelvinkipruto Sep 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/codeforafrica/content/pages/about-members-individual.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
related-projects:
title: Projects
seo:
title-template: "%s | Members | About | Code for Africa"
---
2 changes: 2 additions & 0 deletions apps/codeforafrica/content/pages/about-partners-individual.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
related-projects:
title: Related Projects
seo:
title-template: "%s | Partners | About | Code for Africa"
---
17 changes: 6 additions & 11 deletions apps/codeforafrica/content/pages/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,14 @@ contact-form:


<!--End mc_embed_signup-->
join-us:
icon:
join-our-slack:
action:
href: https://docs.google.com/forms/d/e/1FAIpQLSdkfLU2yi2S1_7D27Z0I1TumkWy5brlam809Od9cc6CnXGA-A/viewform
src: /images/type-slack-size-64-color-currentcolor.svg
title: We are on Slack!
label: Join Our Slack
subtitle: Join us
action: JOIN OUR SLACK
offices-addresses:
- f80da5cc-a72c-4573-abe4-cf0432f1dd87
- 309d67f8-6bb8-46fd-873f-d0475ddee974
- 54814d5a-d844-425d-aa3d-f466a2e71afd
- a57c5c5a-32ab-4e00-a57f-f8b050b58e63
- 4f079340-a9b1-464a-801a-4edabb67b6e8
title: We are on Slack!
our-offices:
title: Our Offices
seo:
title: Contact Us
description: Let’s start something together!
Expand Down
6 changes: 1 addition & 5 deletions apps/codeforafrica/content/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ hero:
image:
src: /images/group-4429.png
projects:
- 14fdf60f-2928-4776-b208-6641e8413f74
- 7e3a1ef1-576d-4428-824d-a12fa774519d
- afcfdec9-99d7-4f2c-8bdb-964159c0676d
- 07f3259e-2379-4850-83b8-85cacde0fcb8
- 31626677-0bc8-49cb-a2e6-1d7e5504d1fe
title: Projects
meet-our-team:
title: Our pan-African team is spread across the continent
description: >-
Expand Down
2 changes: 2 additions & 0 deletions apps/codeforafrica/content/pages/opportunities.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
hero:
title: Opportunities
subtitle: Come build digital democracies with Code for Africa
opportunities:
title: Opportunities
seo:
title: Opportunities
description: Come build digital democracies with Code for Africa
Expand Down
7 changes: 7 additions & 0 deletions apps/codeforafrica/content/pages/our-work-individual.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---
team:
title: Team
news-stories:
title: Related stories
articles-count: 3
related-projects:
title: Explore other projects
seo:
title-template: "%s | Our Work | Code for Africa"
---
2 changes: 2 additions & 0 deletions apps/codeforafrica/content/pages/our-work.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
hero:
title: Our Work
subtitle: We launch data-driven initiatives to achieve impactful results
projects:
title: Projects
seo:
meta:
title: Our Work
Expand Down
3 changes: 3 additions & 0 deletions apps/codeforafrica/content/pages/stories-individual.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
news-stories:
title: Recent stories
articles-count: 3
seo:
title-template: "%s | Stories | Code for Africa"
---
4 changes: 3 additions & 1 deletion apps/codeforafrica/content/pages/stories.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
stories:
title: Stories
seo:
title: "Stories"
title: Stories
---
16 changes: 9 additions & 7 deletions apps/codeforafrica/src/lib/api.netlify-cms/getContactForm.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "contact-form";

function getContactForm() {
const { "contact-form": contactForm } = getCollectionBySlug(
"content/pages",
"contact",
["contact-form"]
).items;
const { "embed-code": embedCode } = contactForm || {};
return { embedCode };
const contactForm = getCollectionBySlug("content/pages", "contact", [
FIELD_NAME,
"slug",
]).items[FIELD_NAME];
const { "embed-code": embedCode, slug } = contactForm || {};

return { embedCode, slug };
}

export default getContactForm;
5 changes: 2 additions & 3 deletions apps/codeforafrica/src/lib/api.netlify-cms/getGetInTouch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getCollectionBySlug } from "./utils";

export default function getGetInTouch() {
return getCollectionBySlug("content/pages", "about", ["get-in-touch"]).items[
"get-in-touch"
];
return getCollectionBySlug("content/pages", "about", ["get-in-touch", "slug"])
.items["get-in-touch"];
}
10 changes: 10 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getJoinUs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getCollectionBySlug } from "./utils";

function getJoinUs() {
return getCollectionBySlug("content/pages", "contact", [
"join-our-slack",
"slug",
]).items["join-our-slack"];
}

export default getJoinUs;
14 changes: 8 additions & 6 deletions apps/codeforafrica/src/lib/api.netlify-cms/getNewsAndStories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { getCollectionBySlug } from "./utils";
const FIELD_NAME = "news-stories";

function getNewsAndStories(page) {
const { "articles-count": count, title } = getCollectionBySlug(
"content/pages",
page,
[FIELD_NAME]
).items[FIELD_NAME];
const {
"articles-count": count,
title,
slug,
} = getCollectionBySlug("content/pages", page, [FIELD_NAME, "slug"]).items[
FIELD_NAME
];

return { count, title };
return { count, title, slug };
}

export default getNewsAndStories;
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { getCollectionBySlug } from "./utils";
const pagesDir = join(process.cwd(), "content/pages");

function getOurGuidingPrinciples() {
const { title, "guiding-principle-list": principleIds } = getCollectionBySlug(
pagesDir,
"about",
["guiding-principles"]
).items["guiding-principles"];
const {
title,
"guiding-principle-list": principleIds,
slug,
} = getCollectionBySlug(pagesDir, "about", ["guiding-principles", "slug"])
.items["guiding-principles"];
const allPrinciples = getGuidingPrinciples([
"id",
"title",
Expand All @@ -20,7 +21,7 @@ function getOurGuidingPrinciples() {

const list =
principleIds?.map((id) => allPrinciples.find((p) => p.id === id)) ?? null;
return { title, list };
return { title, list, slug };
}

export default getOurGuidingPrinciples;
11 changes: 8 additions & 3 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurImpact.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ const pageDir = join(process.cwd(), "content/pages");

export default function geOurImpact(page = "index") {
const {
"our-impact": { action = null, "impact-list": impactIds, title = null },
} = getCollectionBySlug(pageDir, page, ["our-impact"]).items;
"our-impact": {
action = null,
"impact-list": impactIds,
title = null,
slug = null,
},
} = getCollectionBySlug(pageDir, page, ["our-impact", "slug"]).items;
const impact = getImpactList();
// Need to maintain order of how impact were selected in ourImpact
const list = impactIds?.map((id) => impact.find((i) => i.id === id)) ?? null;

return { action, list, title };
return { action, list, title, slug };
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const pagesDir = join(process.cwd(), "content/pages");
export default function getOurMission() {
const { "our-mission": ourMission } = getCollectionBySlug(pagesDir, "about", [
"our-mission",
"slug",
]).items;
ourMission.description = marked(ourMission.description);

Expand Down
9 changes: 9 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurOffices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "our-offices";

export default function getOurOffices(page = "contact") {
return getCollectionBySlug("content/pages", page, [FIELD_NAME, "slug"]).items[
FIELD_NAME
];
}
12 changes: 12 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurOpportunities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "opportunities";

export default function getOurOpportunities(page = "opportunities") {
const { slug } = getCollectionBySlug("content/pages", page, [
FIELD_NAME,
"slug",
]).items[FIELD_NAME];

return { slug };
}
5 changes: 3 additions & 2 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurPartners.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ const pageDir = join(process.cwd(), "content/pages");
export default function geOurPartners(page = "index") {
const {
"our-partners": {
slug,
title: originalTitle,
"partners-list": partnersIds,
action = null,
},
} = getCollectionBySlug(pageDir, page, ["our-partners"]).items;
} = getCollectionBySlug(pageDir, page, ["our-partners", "slug"]).items;
const title = marked.parseInline(originalTitle);
const allPartners = getPartners([
"id",
Expand All @@ -31,5 +32,5 @@ export default function geOurPartners(page = "index") {
? partnersIds?.map((id) => allPartners.find((p) => p.id === id)) ?? null
: allPartners;

return { title, list, action };
return { slug, partners: { title, list, action } };
}
12 changes: 12 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurProjects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "projects";

export default function geOurProjects(page = "index") {
const { slug } = getCollectionBySlug("content/pages", page, [
FIELD_NAME,
"slug",
]).items[FIELD_NAME];

return { slug };
}
9 changes: 9 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurStories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "stories";

export default function getOurStories(page = "stories") {
return getCollectionBySlug("content/pages", page, [FIELD_NAME, "slug"]).items[
FIELD_NAME
];
}
6 changes: 3 additions & 3 deletions apps/codeforafrica/src/lib/api.netlify-cms/getOurTeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { getCollectionBySlug } from "./utils";

export default function geOurPartners() {
const {
"our-team": { title },
} = getCollectionBySlug("content/pages", "about", ["our-team"]).items;
"our-team": { title, slug },
} = getCollectionBySlug("content/pages", "about", ["our-team", "slug"]).items;

return { title };
return { title, slug };
}
9 changes: 9 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getProjectTeam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "team";

export default function getProjectTeam(page = "our-work-individual") {
return getCollectionBySlug("content/pages", page, [FIELD_NAME, "slug"]).items[
FIELD_NAME
];
}
11 changes: 11 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getRelatedProjects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getCollectionBySlug } from "./utils";

const FIELD_NAME = "related-projects";

function getRelatedProjects(page) {
return getCollectionBySlug("content/pages", page, [FIELD_NAME, "slug"]).items[
FIELD_NAME
];
}

export default getRelatedProjects;
14 changes: 14 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import getBody from "./getBody";
import getContactForm from "./getContactForm";
import getGetInTouch from "./getGetInTouch";
import getJoinUs from "./getJoinUs";
import getNewsAndStories from "./getNewsAndStories";
import getOffices from "./getOffices";
import getOurGuidingPrinciples from "./getOurGuidingPrinciples";
import getOurImpact from "./getOurImpact";
import getOurMission from "./getOurMission";
import getOurOffices from "./getOurOffices";
import getOurOpportunities from "./getOurOpportunities";
import getOurPartners from "./getOurPartners";
import getOurProjects from "./getOurProjects";
import getOurStories from "./getOurStories";
import getOurTeam from "./getOurTeam";
import getPartners from "./getPartners";
import getCmsProjects from "./getProjects";
import getProjectTeam from "./getProjectTeam";
import getRelatedProjects from "./getRelatedProjects";
import getTeam from "./getTeam";
import getFooter from "./sections/getFooter";
import getHeader from "./sections/getHeader";
Expand All @@ -25,15 +32,22 @@ export {
getHeader,
getHero,
getGetInTouch,
getJoinUs,
getMeetOurTeam,
getNewsAndStories,
getOffices,
getOurGuidingPrinciples,
getOurImpact,
getOurMission,
getOurOffices,
getOurOpportunities,
getOurPartners,
getOurProjects,
getOurStories,
getSeo,
getRelatedProjects,
getOurTeam,
getPartners,
getProjectTeam,
getTeam,
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getCollectionBySlug } from "../utils";

const indexPageDir = join(process.cwd(), "content/pages");

export default function getHero(page, fields = ["hero"]) {
export default function getHero(page, fields = ["hero", "slug"]) {
const { hero } = getCollectionBySlug(indexPageDir, page, fields).items;
hero.title = marked.parseInline(hero.title);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const indexPageDir = join(process.cwd(), "content/pages");

export default function getMeetOurTeam(
page = "index",
fields = ["meet-our-team"]
fields = ["meet-our-team", "slug"]
) {
const meetOurTeam = getCollectionBySlug(indexPageDir, page, fields).items[
"meet-our-team"
Expand Down
Loading