mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-09 21:07:49 +00:00
Migrated author info to use GraphQL, added pronouns support to GraphQL
This commit is contained in:
33
authors.js
33
authors.js
@@ -1,33 +0,0 @@
|
||||
const { lstatSync, readdirSync } = require('fs')
|
||||
const { join, basename } = require('path')
|
||||
|
||||
const isDirectory = source => lstatSync(source).isDirectory()
|
||||
const getDirectories = source =>
|
||||
readdirSync(source).map(name => join(source, name)).filter(isDirectory)
|
||||
|
||||
const authorFolders = getDirectories(join(__dirname, 'content', 'assets', 'authors'))
|
||||
|
||||
/**
|
||||
* @typedef {object} socials
|
||||
* @prop {string} socials.twitter - Their Twitter handle, sans `@`
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} authorInfo
|
||||
* @prop {string} authorInfo.name - Their name they wish to have displayed on the page
|
||||
* @prop {string} authorInfo.blurbet - The short form description of author, shown at the bottom of every page
|
||||
* @prop {string} authorInfo.description - The long form description of author
|
||||
* @prop {socials} authorInfo.socials - Their social media links
|
||||
* @prop {[string, string, string, string, string]} authorInfo.pronouns - their preferred pronouns.
|
||||
* Should match order of data here https://github.com/witch-house/pronoun.is
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{[username: string]: authorInfo}}
|
||||
*/
|
||||
module.exports = authorFolders.reduce((prev, folder) => {
|
||||
const username = basename(folder);
|
||||
prev[username] = require(join(folder, 'info'));
|
||||
return prev;
|
||||
}, {})
|
||||
@@ -1,11 +0,0 @@
|
||||
const { findPronouns } = require("../../../../utils/pronoun-helper");
|
||||
|
||||
module.exports = {
|
||||
name: 'Corbin Crutchley',
|
||||
blurbet: 'Is a cool dood',
|
||||
description: 'Is a super mega rad human being',
|
||||
socials: {
|
||||
twitter: 'crutchcorn'
|
||||
},
|
||||
pronouns: findPronouns('they')
|
||||
};
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 530 KiB |
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: My Second Post!
|
||||
date: "2015-05-06T23:46:37.121Z"
|
||||
author: 'thing'
|
||||
author: 'demoperson'
|
||||
attached: ['./file.txt']
|
||||
---
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
const authors = require('./authors');
|
||||
|
||||
module.exports = {
|
||||
siteMetadata: {
|
||||
title: `Unicorn Utterances`,
|
||||
description: `Learning programming from magically magestic words`,
|
||||
siteUrl: `https://unicorn-utterances.com/`,
|
||||
authors
|
||||
siteUrl: `https://unicorn-utterances.com/`
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
@@ -83,5 +80,6 @@ module.exports = {
|
||||
],
|
||||
mapping: {
|
||||
"MarkdownRemark.frontmatter.author": `AuthorYaml`,
|
||||
"AuthorYaml.pronouns": `PronounsYaml`
|
||||
},
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function Bio({author}) {
|
||||
{author.blurbet}
|
||||
{` `}
|
||||
<a href={`https://twitter.com/${author.socials.twitter}`}>
|
||||
You should follow {author.pronouns[1]} on Twitter
|
||||
You should follow {author.pronouns.them} on Twitter
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
description: 'Is a super mega rad human being'
|
||||
socials:
|
||||
twitter: 'crutchcorn'
|
||||
pronouns: ['they', 'them', 'their', 'themselves']
|
||||
pronouns: 'they/themselves'
|
||||
profileImg: './crutchcorn.png'
|
||||
- id: joe
|
||||
name: 'Joe Casenova'
|
||||
@@ -12,13 +12,13 @@
|
||||
description: 'Is a super mega rad human being'
|
||||
socials:
|
||||
twitter: 'crutchcorn'
|
||||
pronouns: ['they', 'them', 'their', 'themselves']
|
||||
pronouns: 'he'
|
||||
profileImg: './crutchcorn.png'
|
||||
- id: thing
|
||||
name: 'Thing 1'
|
||||
- id: demoperson
|
||||
name: 'Demo Person'
|
||||
blurbet: 'Is a cool dood'
|
||||
description: 'Is a super mega rad human being'
|
||||
socials:
|
||||
twitter: 'crutchcorn'
|
||||
pronouns: ['they', 'them', 'their', 'themselves']
|
||||
pronouns: 'it'
|
||||
profileImg: './crutchcorn.png'
|
||||
|
||||
241
src/data/pronouns.yaml
Normal file
241
src/data/pronouns.yaml
Normal file
@@ -0,0 +1,241 @@
|
||||
# This file was converted from TSV file from https://pronoun.is for easier GraphQL usage
|
||||
- id: she
|
||||
they: she
|
||||
them: her
|
||||
their: her
|
||||
theirs: hers
|
||||
themselves: herself
|
||||
- id: he
|
||||
they: he
|
||||
them: him
|
||||
their: his
|
||||
theirs: his
|
||||
themselves: himself
|
||||
- id: they/themselves
|
||||
they: they
|
||||
them: them
|
||||
their: their
|
||||
theirs: theirs
|
||||
themselves: themselves
|
||||
- id: they/themself
|
||||
they: they
|
||||
them: them
|
||||
their: their
|
||||
theirs: theirs
|
||||
themselves: themself
|
||||
- id: ze/hir
|
||||
they: ze
|
||||
them: hir
|
||||
their: hir
|
||||
theirs: hirs
|
||||
themselves: hirself
|
||||
- id: ze/zir
|
||||
they: ze
|
||||
them: zir
|
||||
their: zir
|
||||
theirs: zirs
|
||||
themselves: zirself
|
||||
- id: xey
|
||||
they: xey
|
||||
them: xem
|
||||
their: xyr
|
||||
theirs: xyrs
|
||||
themselves: xemself
|
||||
- id: ae
|
||||
they: ae
|
||||
them: aer
|
||||
their: aer
|
||||
theirs: aers
|
||||
themselves: aerself
|
||||
- id: e
|
||||
they: e
|
||||
them: em
|
||||
their: eir
|
||||
theirs: eirs
|
||||
themselves: emself
|
||||
- id: ey
|
||||
they: ey
|
||||
them: em
|
||||
their: eir
|
||||
theirs: eirs
|
||||
themselves: eirself
|
||||
- id: fae
|
||||
they: fae
|
||||
them: faer
|
||||
their: faer
|
||||
theirs: faers
|
||||
themselves: faerself
|
||||
- id: fey
|
||||
they: fey
|
||||
them: fem
|
||||
their: feir
|
||||
theirs: feirs
|
||||
themselves: feirself
|
||||
- id: hu
|
||||
they: hu
|
||||
them: hum
|
||||
their: hus
|
||||
theirs: hus
|
||||
themselves: humself
|
||||
- id: it
|
||||
they: it
|
||||
them: it
|
||||
their: its
|
||||
theirs: its
|
||||
themselves: itself
|
||||
- id: jee
|
||||
they: jee
|
||||
them: jem
|
||||
their: jeir
|
||||
theirs: jeirs
|
||||
themselves: jemself
|
||||
- id: kit
|
||||
they: kit
|
||||
them: kit
|
||||
their: kits
|
||||
theirs: kits
|
||||
themselves: kitself
|
||||
- id: ne
|
||||
they: ne
|
||||
them: nem
|
||||
their: nir
|
||||
theirs: nirs
|
||||
themselves: nemself
|
||||
- id: peh
|
||||
they: peh
|
||||
them: pehm
|
||||
their: peh's
|
||||
theirs: peh's
|
||||
themselves: pehself
|
||||
- id: per
|
||||
they: per
|
||||
them: per
|
||||
their: per
|
||||
theirs: pers
|
||||
themselves: perself
|
||||
- id: sie
|
||||
they: sie
|
||||
them: hir
|
||||
their: hir
|
||||
theirs: hirs
|
||||
themselves: hirself
|
||||
- id: se
|
||||
they: se
|
||||
them: sim
|
||||
their: ser
|
||||
theirs: sers
|
||||
themselves: serself
|
||||
- id: shi
|
||||
they: shi
|
||||
them: hir
|
||||
their: hir
|
||||
theirs: hirs
|
||||
themselves: hirself
|
||||
- id: si
|
||||
they: si
|
||||
them: hyr
|
||||
their: hyr
|
||||
theirs: hyrs
|
||||
themselves: hyrself
|
||||
- id: they/thonself
|
||||
they: thon
|
||||
them: thon
|
||||
their: thons
|
||||
theirs: thons
|
||||
themselves: thonself
|
||||
- id: ve/vis/verself
|
||||
they: ve
|
||||
them: ver
|
||||
their: vis
|
||||
theirs: vis
|
||||
themselves: verself
|
||||
- id: ve/vir/vemself
|
||||
they: ve
|
||||
them: vem
|
||||
their: vir
|
||||
theirs: virs
|
||||
themselves: vemself
|
||||
- id: vi/ver/verself
|
||||
they: vi
|
||||
them: ver
|
||||
their: ver
|
||||
theirs: vers
|
||||
themselves: verself
|
||||
- id: vi/vir/vimself
|
||||
they: vi
|
||||
them: vim
|
||||
their: vir
|
||||
theirs: virs
|
||||
themselves: vimself
|
||||
- id: vi/vim/vimself
|
||||
they: vi
|
||||
them: vim
|
||||
their: vim
|
||||
theirs: vims
|
||||
themselves: vimself
|
||||
- id: xie
|
||||
they: xie
|
||||
them: xer
|
||||
their: xer
|
||||
theirs: xers
|
||||
themselves: xerself
|
||||
- id: xe
|
||||
they: xe
|
||||
them: xem
|
||||
their: xyr
|
||||
theirs: xyrs
|
||||
themselves: xemself
|
||||
- id: xey
|
||||
they: xey
|
||||
them: xem
|
||||
their: xeir
|
||||
theirs: xeirs
|
||||
themselves: xemself
|
||||
- id: yo
|
||||
they: yo
|
||||
them: yo
|
||||
their: yos
|
||||
theirs: yos
|
||||
themselves: yosself
|
||||
- id: ze/zirself
|
||||
they: ze
|
||||
them: zem
|
||||
their: zes
|
||||
theirs: zes
|
||||
themselves: zirself
|
||||
- id: ze
|
||||
they: ze
|
||||
them: mer
|
||||
their: zer
|
||||
theirs: zers
|
||||
themselves: zemself
|
||||
- id: zee
|
||||
they: zee
|
||||
them: zed
|
||||
their: zeta
|
||||
theirs: zetas
|
||||
themselves: zedself
|
||||
- id: zie/zir
|
||||
they: zie
|
||||
them: zir
|
||||
their: zir
|
||||
theirs: zirs
|
||||
themselves: zirself
|
||||
- id: zie/zem
|
||||
they: zie
|
||||
them: zem
|
||||
their: zes
|
||||
theirs: zes
|
||||
themselves: zirself
|
||||
- id: zie/hir
|
||||
they: zie
|
||||
them: hir
|
||||
their: hir
|
||||
theirs: hirs
|
||||
themselves: hirself
|
||||
- id: zme
|
||||
they: zme
|
||||
them: zmyr
|
||||
their: zmyr
|
||||
theirs: zmyrs
|
||||
themselves: zmyrself
|
||||
@@ -45,6 +45,31 @@ class BlogIndex extends React.Component {
|
||||
|
||||
export default BlogIndex
|
||||
|
||||
export const query = graphql`
|
||||
fragment AuthorInfo on AuthorYaml {
|
||||
name
|
||||
blurbet
|
||||
description
|
||||
socials {
|
||||
twitter
|
||||
}
|
||||
pronouns {
|
||||
they
|
||||
them
|
||||
their
|
||||
theirs
|
||||
themselves
|
||||
}
|
||||
profileImg {
|
||||
childImageSharp {
|
||||
fixed(width: 50, height: 50) {
|
||||
...GatsbyImageSharpFixed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query {
|
||||
site {
|
||||
@@ -64,20 +89,7 @@ export const pageQuery = graphql`
|
||||
title
|
||||
description
|
||||
author {
|
||||
name
|
||||
blurbet
|
||||
description
|
||||
socials {
|
||||
twitter
|
||||
}
|
||||
pronouns
|
||||
profileImg {
|
||||
childImageSharp {
|
||||
fixed(width: 50, height: 50) {
|
||||
...GatsbyImageSharpFixed
|
||||
}
|
||||
}
|
||||
}
|
||||
...AuthorInfo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,20 +85,7 @@ export const pageQuery = graphql`
|
||||
description
|
||||
license
|
||||
author {
|
||||
name
|
||||
blurbet
|
||||
description
|
||||
socials {
|
||||
twitter
|
||||
}
|
||||
pronouns
|
||||
profileImg {
|
||||
childImageSharp {
|
||||
fixed(width: 50, height: 50) {
|
||||
...GatsbyImageSharpFixed
|
||||
}
|
||||
}
|
||||
}
|
||||
...AuthorInfo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const pronounIsFile = fs.readFileSync(path.join(__dirname, 'pronouns.tab'), 'utf8');
|
||||
|
||||
const pronoun2DArr = pronounIsFile
|
||||
.split('\n')
|
||||
.map(pronounRow => pronounRow.split('\t'));
|
||||
|
||||
/**
|
||||
* @param matchStr - The string to match to
|
||||
* @returns {[string, string, string, string, string]} authorInfo.pronouns - their preferred pronouns.
|
||||
* Should match order of data here https://github.com/witch-house/pronoun.is
|
||||
*/
|
||||
const findPronouns = (matchStr) => {
|
||||
return pronoun2DArr.find(pronounList => pronounList.includes(matchStr));
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} socials
|
||||
* @prop {string} socials.twitter - Their Twitter handle, sans `@`
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} authorInfo
|
||||
* @prop {string} authorInfo.username - The unique key to that user
|
||||
* @prop {string} authorInfo.name - Their name they wish to have displayed on the page
|
||||
* @prop {string} authorInfo.blurbet - The short form description of author, shown at the bottom of every page
|
||||
* @prop {string} authorInfo.description - The long form description of author
|
||||
* @prop {socials} authorInfo.socials - Their social media links
|
||||
* @prop {[string, string, string, string, string]} authorInfo.pronouns - their preferred pronouns.
|
||||
* Should match order of data here https://github.com/witch-house/pronoun.is
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {authorInfo}
|
||||
*/
|
||||
module.exports = {
|
||||
pronoun2DArr,
|
||||
findPronouns
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
she her her hers herself
|
||||
he him his his himself
|
||||
they them their theirs themselves
|
||||
ze hir hir hirs hirself
|
||||
ze zir zir zirs zirself
|
||||
xey xem xyr xyrs xemself
|
||||
ae aer aer aers aerself
|
||||
e em eir eirs emself
|
||||
ey em eir eirs eirself
|
||||
fae faer faer faers faerself
|
||||
fey fem feir feirs feirself
|
||||
hu hum hus hus humself
|
||||
it it its its itself
|
||||
jee jem jeir jeirs jemself
|
||||
kit kit kits kits kitself
|
||||
ne nem nir nirs nemself
|
||||
peh pehm peh's peh's pehself
|
||||
per per per pers perself
|
||||
sie hir hir hirs hirself
|
||||
se sim ser sers serself
|
||||
shi hir hir hirs hirself
|
||||
si hyr hyr hyrs hyrself
|
||||
they them their theirs themself
|
||||
thon thon thons thons thonself
|
||||
ve ver vis vis verself
|
||||
ve vem vir virs vemself
|
||||
vi ver ver vers verself
|
||||
vi vim vir virs vimself
|
||||
vi vim vim vims vimself
|
||||
xie xer xer xers xerself
|
||||
xe xem xyr xyrs xemself
|
||||
xey xem xeir xeirs xemself
|
||||
yo yo yos yos yosself
|
||||
ze zem zes zes zirself
|
||||
ze mer zer zers zemself
|
||||
zee zed zeta zetas zedself
|
||||
zie zir zir zirs zirself
|
||||
zie zem zes zes zirself
|
||||
zie hir hir hirs hirself
|
||||
zme zmyr zmyr zmyrs zmyrself
|
||||
Reference in New Issue
Block a user