Open hollandjg opened 8 months ago
There are several types of images in project portal and they are configured in different ways:
Project Images are the images you can see rendered on project pages.
project
collection in packages/project-portal-content-decap/src/cms/cms.js
example-site
repo in the /static/image
folder (the media_folder
in the collection). gatsby-config
files.Favicon is the image that is shown in the browser tab.
faviconPath
, by default is packages/gatsby-theme-project-portal/images/default-icon.png
packages/gatsby-theme-project-portal/gatsby-config.js
, which is populated by the defaultOptions
function in packages/gatsby-theme-project-portal/utils/default-options.js
.faviconPath
can also be adjusted in example-site by editing siteMetadata
in packages/example-site/gatsby-config.js
.Theme Images are images that are tightly tied to the components in the theme, including things like banner, navbar, and footer images
themeImages
for example-site
are stored in themeImageDirectory
(e.g.,packages/example-site/content/theme-image/bottom-banner.png
)packages/gatsby-theme-project-portal/gatsby-config.js
, which is populated by the defaultOptions
function in packages/gatsby-theme-project-portal/utils/default-options.js
.graphql
queries in the layouts (like packages/gatsby-theme-project-portal/src/layouts/Layout.tsx
) dictate which images should be used for navbarLogo
, bottomBannerLogo
, and footerLogo
-- for example this code chunk says the navbarLogo should be a file called navbar
with a png
, jpg
, or jpeg
file extension (?). navbarLogo: file(
name: { eq: "navbar" }
extension: { in: ["png", "jpg", "jpeg"] }
sourceInstanceName: { eq: "themeImages" }
) {
childImageSharp {
gatsbyImageData(height: 64)
}
}
socialShareImage
is also part of the themeImages
and is stored in the themeImageDirectory
and is specified in packages/gatsby-theme-project-portal/src/hooks/Head.tsx
Contact Icons are the images that are used as the image for contacts.
packages/example-site/content/contact/first-contact.png
and packages/example-site/content/contact/first-contact.json
)packages/project-portal-content-decap/gatsby-config.js
, which is populated by packages/project-portal-content-decap/utils/default-options.js
(only for contact
and image
, but not theme-image
, which is set by the gatsby-theme-project-portal
project in default-options.js
and gatsby-config.js
). packages/example-site/content/contact/the-boss.json
for an example).contact
collection in packages/project-portal-content-decap/src/cms/cms.js
Images are the background images that are part of the header-with-image
component.
packages/example-site/content/image
. packages/project-portal-content-decap/gatsby-config.js
, which is populated by packages/project-portal-content-decap/utils/default-options.js
(only for contact
and image
, but not theme-image
, which is set by the gatsby-theme-project-portal
project in default-options.js
and gatsby-config.js
) public_folder
and media_folder
happens in the the cardPage
and page
collection in packages/project-portal-content-decap/src/cms/cms.js
cardPage
collection can be adjusted by the end user in CMS (as of issue #746).
It looks to me as though the handling of images on the whole – where they get stored, how they are divided up, and whether you can set images for the layout components from the CMS (you can't right now) – needs another look, but that's a different PR. It feels like, with this PR, we're getting the hang of handling images!
Originally posted by @hollandjg in https://github.com/thepolicylab-projectportals/project-portal-theme/pull/651#pullrequestreview-1690708586