Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes <Image> component URLs #68

Merged
merged 6 commits into from
Sep 10, 2024
Merged

Fixes <Image> component URLs #68

merged 6 commits into from
Sep 10, 2024

Conversation

samglover
Copy link
Contributor

This fixes bugs introduced or carried forward by #67 and #63 (on line 12 of the NavigationBar component, specifically).

Image file URLs that were working on my local environment were broken on the staging site, and vice-versa. I tried various relative paths to get around the problem, which didn't work because the staging site is served from a sub-directory of the domain, projects.suffolklitlab.org/courtformsonline.org, while the local environment was served from localhost:3000 with no subdirectory. So the relative paths were different on local v. staging environments and it was always broken on one or the other.

The Next.js basePath documentation led me to the solution. I added the basePath property to next.config.js so that the local and staging environments matched, imported the NextConfig object into files containing <Image> components, and inserted the basePath variable into the src property of the existing <Image> components.

When we change the domain to courtformsonline.org, we will need to update or remove the basePath property in next.config.js (either will work). The basePath import and the basePath segment in <Image> component src properties can be removed, as well (but will work fine if they are left in place).

I will update the launch checklist (#50) with those steps.

@samglover
Copy link
Contributor Author

One more note. It looks like @jtmst was using a local environment variable to add /courtformsonline.org to the basePath only on his local environment. I think it's easier to detect broken file paths if the local environment matches the staging site more closely, so I prefer this approach.

@nonprofittechy nonprofittechy merged commit 06e4891 into main Sep 10, 2024
2 checks passed
@samglover samglover deleted the restore_logo_url branch September 10, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants