Skip to content

Resurrect section html theming, custom layouts w/ fallback #200

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

Merged
merged 4 commits into from
Dec 4, 2020

Conversation

isaacwhite
Copy link
Member

@isaacwhite isaacwhite commented Jul 30, 2020

Description of Change

This PR makes two changes to the way our templates work to support custom layouts.

  1. It extends ejs view resolution logic to search custom/layouts first, before the default layouts folder
  2. It updates the getTemplates() utility function to attempt to search this custom/layouts directory as well.

It also changes all the partial includes to not use relative paths, which means custom partials can also be resolved from a custom/layouts folder.

This change makes preexisting logic that allowed custom category templates based on the root path of Library urls more useful, because now you could add a custom/layouts/categories folder with your-base-url-segment.ejs and override the root template for subcategories of your Library site.

Related Issue

#45 #36

Motivation and Context

There are a few exciting possibilities that custom HTML opens up for Library sites. This change represents a first pass at reenabling some customization functionality that was envisioned since the beginning, and empowering custom folder overrides to also change the HTML of any portion of the Library page, which was a missing feature at the time we originally open sourced the project.

Checklist

  • Ran npm run lint and updated code style accordingly
  • npm run test passes
  • PR has a description and all contributors/stakeholder are noted/cc'ed
  • [ ] tests are updated and/or added to cover new code
  • relevant documentation is changed and/or added

@isaacwhite
Copy link
Member Author

cc @thebestsophist and @knowtheory, who asked about this over in #proj-library.

@isaacwhite isaacwhite requested a review from afischer September 3, 2020 15:05
Copy link
Member

@afischer afischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
We should be sure to update the documentation about this as well.

@isaacwhite isaacwhite self-assigned this Nov 19, 2020
@isaacwhite isaacwhite changed the title [WIP] Resurrect section html theming, custom layouts w/ fallback Resurrect section html theming, custom layouts w/ fallback Dec 4, 2020
@isaacwhite isaacwhite merged commit 759bdaf into master Dec 4, 2020
@isaacwhite isaacwhite deleted the custom-layouts branch December 4, 2020 07:27
@isaacwhite isaacwhite mentioned this pull request Dec 15, 2020
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