-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from NobbZ/192-add-author-to-article-and-prev…
…iew-pages
- Loading branch information
Showing
26 changed files
with
1,078 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
slug: "nobbz" | ||
first_name: "Norbert" | ||
last_name: "Melzer" | ||
nick_name: "NobbZ" | ||
social: | ||
amazon: "https://www.amazon.de/hz/wishlist/ls/1GZRUIT9EP93R?ref_=wl_share" | ||
github: "NobbZ" | ||
gitlab: "NobbZ" | ||
ko-fi: "nobbz" | ||
linkedin: "norbert-melzer-a175829a" | ||
twitter: "NobbZ1981" | ||
web: | ||
url: "https://blog.nobbz.dev/" | ||
name: "NobbZ Blog" | ||
--- | ||
|
||
Norbert is a software developer from Germany, whos primary language is [Elixir]. | ||
|
||
[Elixir]: https://elixir-lang.org/ | ||
|
||
His strong interest in Elixir began during his studies somewhen in 2014, when | ||
he wanted to use a "functional alternative to [Ruby]" in a programming contest at | ||
the university. | ||
|
||
[Ruby]: https://www.ruby-lang.org/ | ||
|
||
When he wanted to test his contestant on the designated machine, he found out | ||
that the erlang version installed did not support any released version of Elixir, | ||
so he had to rewrite his contestant in [Erlang]. | ||
|
||
[Erlang]: https://www.erlang.org/ | ||
|
||
For a long time he used both languages in parallel, and became an Erlang track | ||
maintainer at [Exercism] during 2015, where he still is. Within the same year | ||
he also became a member and moderator of the [Elixir Forum], where he is still | ||
active as well. | ||
|
||
[Exercism]: https://exercism.org/ | ||
[Elixir Forum]: https://elixirforum.com/ | ||
|
||
In 2016 he started to work professionally to be able to pay for his university. | ||
During that job he used mostly [Go] and [Python], though was able to use any | ||
language necessary to get the job done. | ||
|
||
[Go]: https://golang.org/ | ||
[Python]: https://www.python.org/ | ||
|
||
This did include [PHP], [Java], [C++], and [JavaScript] as well. | ||
|
||
[PHP]: https://www.php.net/ | ||
[Java]: https://www.java.com/ | ||
[C++]: https://isocpp.org/ | ||
[JavaScript]: https://www.javascript.com/ | ||
|
||
In 2022 he finally was able to find a job where he was able to use Elixir | ||
professionally, and is now working as a backend developer. | ||
|
||
Besides of doing software development, he is also a passionate user of [NixOS]. | ||
He currently maintains a few packages in the official repository, and is | ||
also using it on his 2 private machines. He also plays with [`nix`] on a virtual | ||
machine on his work laptop (Apple). | ||
|
||
[NixOS]: https://nixos.org/ | ||
[`nix`]: https://nixos.org/manual/nix/stable/#ch-about-nix | ||
|
||
For all the `nix` related things he is also active on the [NixOS Discourse] and | ||
the inofficial [NixOS Discord]. | ||
|
||
[NixOS Discourse]: https://discourse.nixos.org/ | ||
[NixOS Discord]: https://discord.gg/fFQp8hqY | ||
|
||
Besides all his technical hobbies, he also is a father of 2 children. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { GatsbyNode, NodeInput } from "gatsby"; | ||
|
||
import { IMdxNode } from "gatsby-plugin-mdx/dist/types"; | ||
|
||
interface AuthorParentNode extends IMdxNode { | ||
parent: string; | ||
fields: { readingTime: unknown }; | ||
frontmatter: { | ||
slug: string; | ||
first_name?: string; | ||
last_name?: string; | ||
nick_name?: string; | ||
social?: Record<string, string | Record<string, unknown>>; | ||
}; | ||
} | ||
|
||
export const createSchemaCustomization: GatsbyNode["createSchemaCustomization"] = | ||
({ actions }) => { | ||
const { createTypes } = actions; | ||
|
||
createTypes(` | ||
type Author implements Node { | ||
slug: String! | ||
firstName: String! | ||
lastName: String! | ||
nickName: String | ||
social: JSON | ||
articles: [Blog] @link(by: "author.slug", from: "slug") | ||
} | ||
`); | ||
}; | ||
|
||
export const shouldOnCreateNode: GatsbyNode<IMdxNode>["shouldOnCreateNode"] = ({ | ||
node, | ||
}) => { | ||
return ( | ||
node.internal.type === "Mdx" && | ||
!!node.parent && | ||
// node.parent.sourceInstanceName === "author" | ||
(node.fields as undefined | { source: string })?.source === "author" | ||
); | ||
}; | ||
|
||
export const onCreateNode: GatsbyNode<AuthorParentNode>["onCreateNode"] = ({ | ||
node, | ||
actions, | ||
createNodeId, | ||
}) => { | ||
const { createNode, createParentChildLink } = actions; | ||
|
||
const authorNode: NodeInput = { | ||
id: createNodeId(`${node.id} >>> author`), | ||
internal: { | ||
type: "Author", | ||
contentDigest: node.internal.contentDigest, | ||
contentFilePath: node.internal.contentFilePath, | ||
}, | ||
slug: node.frontmatter.slug, | ||
firstName: node.frontmatter.first_name, | ||
lastName: node.frontmatter.last_name, | ||
nickName: node.frontmatter.nick_name, | ||
social: node.frontmatter.social, | ||
}; | ||
|
||
createNode(authorNode); | ||
createParentChildLink({ parent: node, child: authorNode }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "gatsby-transformer-nz-author", | ||
"version": "1.0.0", | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { GatsbyNode, NodeInput } from "gatsby"; | ||
|
||
import { IMdxNode } from "gatsby-plugin-mdx/dist/types"; | ||
import { FileSystemNode } from "gatsby-source-filesystem"; | ||
|
||
interface BlogParentNode extends IMdxNode { | ||
parent: string; | ||
fields: { readingTime: unknown }; | ||
frontmatter: { | ||
author: string; | ||
title: string; | ||
slug: string; | ||
date: Date; | ||
tags: string[]; | ||
hero_image_alt: string; | ||
hero_image_link: string; | ||
hero_image_credit_link: string; | ||
hero_image_credit: string; | ||
hero_image: FileSystemNode; | ||
}; | ||
} | ||
|
||
export const createSchemaCustomization: GatsbyNode["createSchemaCustomization"] = | ||
({ actions }) => { | ||
const { createTypes } = actions; | ||
|
||
createTypes(` | ||
type HeroImageData { | ||
alt: String! | ||
link: String! | ||
credit: String! | ||
creditLink: String! | ||
} | ||
type Blog implements Node { | ||
title: String! | ||
author: Author @link(by: "slug") | ||
slug: String! | ||
date: Date! | ||
tags: [String!]! | ||
heroImage: HeroImageData! | ||
excerpt: String | ||
} | ||
`); | ||
}; | ||
|
||
export const shouldOnCreateNode: GatsbyNode<IMdxNode>["shouldOnCreateNode"] = ({ | ||
node, | ||
}) => { | ||
return ( | ||
node.internal.type === "Mdx" && | ||
!!node.parent && | ||
// node.parent.sourceInstanceName === "blog" | ||
(node.fields as undefined | { source: string })?.source === "blog" | ||
); | ||
}; | ||
|
||
export const onCreateNode: GatsbyNode<BlogParentNode>["onCreateNode"] = async ({ | ||
node, | ||
actions, | ||
createNodeId, | ||
}) => { | ||
const { createNode, createParentChildLink } = actions; | ||
|
||
const blogNode: NodeInput = { | ||
id: createNodeId(`${node.id} >>> blog`), | ||
children: [], | ||
parent: node.id, | ||
internal: { | ||
type: "Blog", | ||
contentDigest: node.internal.contentDigest, | ||
contentFilePath: node.internal.contentFilePath, | ||
}, | ||
title: node.frontmatter.title, | ||
slug: node.frontmatter.slug, | ||
date: node.frontmatter.date, | ||
tags: node.frontmatter.tags, | ||
author: node.frontmatter.author, | ||
// TODO: Excerpt seems to be generated lazily on query time, so we need to re-map a resolver later | ||
excerpt: "", | ||
readingTime: node.fields.readingTime, | ||
heroImage: { | ||
alt: node.frontmatter.hero_image_alt, | ||
link: node.frontmatter.hero_image_link, | ||
creditLink: node.frontmatter.hero_image_credit_link, | ||
credit: node.frontmatter.hero_image_credit, | ||
image: node.frontmatter.hero_image as FileSystemNode, | ||
}, | ||
}; | ||
|
||
createNode(blogNode); | ||
createParentChildLink({ parent: node, child: blogNode }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "gatsby-transformer-nz-blog", | ||
"version": "1.0.0", | ||
"private": true | ||
} |
Oops, something went wrong.