Skip to content

Instantly share code, notes, and snippets.

@thomsbg
Created February 5, 2018 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thomsbg/b82863e85918a453de12dfaff97010e9 to your computer and use it in GitHub Desktop.
Save thomsbg/b82863e85918a453de12dfaff97010e9 to your computer and use it in GitHub Desktop.
entry(id: 1234) {
bylines {
name
url
}
}
# The API knows to fetch from various database sources,
# and returns full names vs usernames according to community rules,
# but leaves the formatting as HTML, and comma-joining up to the client
entry(id: 1234) {
byline # <a href="/authors/alice">Alice Author</a>, <a href="/users/connie">Connie Contributor</a>, <a href="http://freddy.name/">Freddy Freelancer</a>
}
# The API knows how to fetch and format the full byline,
# merging together the various db sources for you,
# and respecting community rules on username vs full name.
# The client doesn't have to do anything but drop this into a template.
entry(id: 1234) {
author {
firstName
lastName
username
profileUrl
}
contributors {
firstName
lastName
username
profileUrl
}
additionalByline # <a href="http://freddy.name/">Freddy Freelancer</a>
}
# the api provides data in its raw format, as represented in the database.
# the client decides how to format author names based on community settings,
# create <a> tags, and comma join all of this together
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment