0.9.0 • Published 5 years ago

@undataforum/gatsby-theme-profiles v0.9.0

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

@undataforum/gatsby-theme-profiles

A Gatsby theme to create profile pages and a profiles overview page.

Usage

Theme options

KeyDefault valueDescription
basePath/Root url for all profiles. Should be changed to /profiles in most cases. basePath is used in Gatsby lifecycle methods to generate individual profile pages and the profiles overview page.
contentPathcontent/profilesLocation of profile MDX files. The filename convention is <slug>.md, e.g. antonio-guterres.md. If you do not set a slug in the frontmatter, the MDX file's base name, in this example antonio-guterres, is used as slug. contentPath is used to configure plugin gatsby-source-filesystem. Any file in contentPath is part of the GraphQL Mdx collection.
assetPathcontent/assetsLocation of avatar images. assetPath is used to configure plugin gatsby-source-filesystem. Any image in assetPath can be linked to a profile by adding it to the frontmatter avatar key via relative path. Avatar images can follow any file name convention you like. The recommended convention is <slug>.{jpg|png}, e.g. antonio-guterres.jpg.
collectionprofilesThe collection option is supplied to the name option of plugin gatsby-source-filesystem for the contentPath definition. This makes it possible to filter File nodes by collection using sourceInstanceName. If you configure this theme more than once in gatsby-config.js, you can use collection to distinguish different profile collections, e.g. collection authors for author profiles and collection speakers for speaker profiles.
postCollectionundefinedIf this option is set, it refers to a collection of posts defined with @undataforum/gatsby-theme-blog. On each profile page, all posts from this collection matching the profile's slug are displayed.

This example config shows how to configure two separate profiles collections:

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: '@undataforum/gatsby-theme-profiles',
      options: {
        basePath: '/author-profiles',
        contentPath: 'content/author-profiles',
        assetPath: 'content/assets/author-profiles',
        collection: 'author-profiles'
      },
    },
        {
      resolve: '@undataforum/gatsby-theme-profiles',
      options: {
        basePath: '/speaker-profiles',
        contentPath: 'content/speaker-profiles',
        assetPath: 'content/assets/speaker-profiles',
        collection: 'speaker-profiles'
      },
    },
  ],
}

MDX frontmatter

Frontmatter keys for MDX profiles located in contentPath. The YAML type of each key corresponds to the GraphQL type listed in the following section.

KeyRequiredDescription
avataryesRelative path to avatar image located in the assetPath.
honorificnoHonorific title, e.g. Her Excellency or His Royal Highness.
firstNameyesFirst name.
lastNameyesLast name.
jobtitlenoJob title.
organizationnoOrganization.
slugnoThe default slug is the profile MDX file's base name. This value overrides the default.
descriptionnoThe default description for SEO purposes is the first paragraph in a profile MDX file. This value overrrides the default.
rolesnoOne or more roles that a profile can have. This is a YAML list with role keys as values, e.g. 2020-committee-member or 2018-organizer.

GraphQL Profile type

This theme adds GraphQL type Profile which can be queried with profile and allProfile queries. Type Profile makes no assumptions about what the underlying data source is.

FieldTypeDescription
idID!Gatsby node GUID.
slugID!Alternative ID used for querying and building the graph.
collectionString!Distinguish separate profile collections.
avatarFile!If in the future data sources other than MDX are supported, avatar still needs to be of type File!, e.g. downoaded from Contentful to cache. Data sources need to support gatsby-image.
firstNameString!firstName can be used to sort profiles alphabetically.
lastNameString!lastName can be used to sort profiles alphabetically.
nameString!Display name.
honorificString
jobtitleString
organizationString
descriptionString
bodyString!A string representation of the body of the profile page. For MDX pages this is the MDX body.roles[String!]A role is an identifier that can be used to lookup a role name. A profile can have more than one role.
roles[String!]A role is an identifier that can be used to lookup a role name. A profile can have more than one role.
pathString!Path to generated page.

Localizations

KeyDescription
titleTitle of profiles overview page.
descriptionDescription page metadata for profiles overview page.
relatedPostsHeading for related posts on profile pages. May contain the {firstName} tag.
0.9.0

5 years ago

0.8.2

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.3

6 years ago

0.4.1

6 years ago

0.4.2

6 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago