Socket
Socket
Sign inDemoInstall

@maiertech/gatsby-theme-pages-core

Package Overview
Dependencies
8
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @maiertech/gatsby-theme-pages-core

This theme adds a Page type to Gatsby sites.


Version published
Weekly downloads
10
increased by233.33%
Maintainers
1
Install size
98.7 MB
Created
Weekly downloads
 

Readme

Source

@maiertech/gatsby-theme-pages-core

A Gatsby theme to add a Page type to Gatsby sites.

Options

OptionDefaultDescription
basePath/Basepath for deployments at locations other than root.
contentPathcontent/pagesLocation of MDX files with pages. If pages use images, pages can be placed in a sub-directory as index.mdx together with its assets.
fullRelativePathfalseSet to true to include full path relative to contentPath in path of generated pages.
mdxOtherwiseConfiguredfalseSet this flag true if gatsby-plugin-mdx is already configured for your site.

Frontmatter

KeyRequiredDescription
titlePost title, which will be slugified.
slugOverride slugified title.
descriptionDescription for SEO and previews.
imagesArray of images with src (relative path to image), optional title and mandatory alt text. Images can be embedded into MDX.
canonical_urlCanonical URL for SEO.

Schema customization

Page interface

FieldTypeDescription
idID!Gatsby node GUID.
titleString!From frontmatter.
descriptionString!From frontmatter.
images[PageImage!]Images that can be embedded into a page.
bodyString!MDX body.
pathString!Page path.
canonicalUrlStringCanonical URL for SEO.

Type MdxPage implements Page. If you prefer to use a data source other than MDX files, you can write a child theme that uses the Page interface.

PageImage type

FieldTypeDescription
srcFile!Relative path to image.
titleStringImage title.
altString!Image alt text.

Images in pages

This theme assumes that you will use gatsby-plugin-image to render images in MDX files. Since StaticImage does not work inside MDX files, you have to declare images in the frontmatter with the images prop.

When you shadow page.js, you need to create an images array with gatsbyImageData objects and provide the images array as prop to MDXRenderer. You can then access and render these images with GatsbyImage inside MDX files. This is not ideal and it is intended as workaround until StaticImage can be used inside MDX files.

The downside of dynamic images is that fragment page-fragment.js contains a hard-wired query for dynamic images as constrained images. Therefore, you cannot modify image options and have to go with what the fragment gives you.

Keywords

FAQs

Last updated on 29 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc