sul-dlss / wallscreens

📺 curated experiences for touch-screen installations on the stanford campus
Other
1 stars 0 forks source link

Refactor to use layouts in a more jekyll way #283

Closed thatbudakguy closed 2 years ago

thatbudakguy commented 2 years ago

i had been messing around with this for awhile and couldn't find a way to slice it up into smaller PRs...sorry about that. if it's too big, we can just not merge it, since it doesn't do anything vital.

in essence, this PR establishes a hierarchy of layouts and uses their inheritance to reduce duplication in all of our templates. in so doing, it also adds metadata to those layouts that helps us move little bits of data (like what controller an experience type should use) into the layouts themselves.

you can see the effect of this in the experience files: now, all they need to do is define a wallscreen and a layout, and the layout "remembers" the rest of what needs to happen. if you need to edit something like the <head> section, that only happens in one place (the base template).

prior to this PR, we've been using includes as layouts — the experiences explicitly include the HTML template they want, which then includes other templates. this PR creates a clearer distinction between layouts (a blueprint for an entire page) and includes (a piece that is reused across pages, or a component if you like).

i also added html comments to the layout files to make poking around in the inspector a little easier, and threw in a new include that sets the page title to something that seemed reasonable.

netlify[bot] commented 2 years ago

✔️ Deploy Preview for sul-wallscreens ready!

🔨 Explore the source changes: 07c1e45bc0b5635ac71112ae7d35d4118574e6b9

🔍 Inspect the deploy log: https://app.netlify.com/sites/sul-wallscreens/deploys/61b115a86e6a320008ab2b7b

😎 Browse the preview: https://deploy-preview-283--sul-wallscreens.netlify.app

thatbudakguy commented 2 years ago

@camillevilla great catch — there was indeed a small chunk of the old include that was missing in the new layout. it told the controller which experience index page to navigate to. should be fixed now!