Skip to content

Extract sidebar footer into a shadowable component - #18

Merged
AbuMareBear merged 1 commit into
mainfrom
footer-component
Sep 24, 2026
Merged

AbuMareBear merged 1 commit into
mainfrom
footer-component

Conversation

@AbuMareBear

Copy link
Copy Markdown
Contributor

Summary

  • Extracts the sidebar footer into its own component, BridgetownStoa::SidebarFooter, rendered by bridgetown-stoa/layout in place of the inline markup. Markup is unchanged.
  • Adds BridgetownStoa::Shadowable, a small mixin that makes a gem component look for its template in the host site's src/_components directory before falling back to the gem's copy. Bridgetown resolves a component's template next to the file that defines its Ruby class, which for a gem component is always inside the gem, so without this a host .serb would be silently ignored. (Serbea partials don't help either: they only resolve from the host's _partials dir.)
  • Both Sidebar and SidebarFooter extend the mixin, so src/_components/bridgetown_stoa/sidebar.serb and .../sidebar_footer.serb now shadow the respective templates. Only the template is replaced; the Ruby class still comes from the gem.
  • README gains an "Overriding parts of the layout" section with the shadow paths and a footer example; the whole-layout section now recommends component shadows for single-region changes.

Motivation

Guided-Rails/a11y-lint#115 copies Stoa's entire layout into the docs site just to add a "A Guided Rails project" line to the footer, and its header comment asks for a footer override point. After this ships, that copy can be replaced with a single sidebar_footer.serb.

Test plan

  • script/cibuild — rubocop clean, 15 tests / 52 assertions pass
  • New test/test_sidebar_footer.rb covers the default footer rendering inside <aside> and a host-site template shadowing it (writes and removes a fixture _components dir within the test)
  • Verify live reload of a shadowed template under bin/dev (fast refresh matches on the resolved template path and reloads the component class, but I haven't watched it happen)

🤖 Generated with Claude Code

@AbuMareBear
AbuMareBear merged commit 21b4c62 into main Sep 24, 2026
3 checks passed
@AbuMareBear
AbuMareBear deleted the footer-component branch September 24, 2026 17:40
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.

1 participant