Skip to content

Set page title from @page_title instance variable#25

Draft
raghubetina wants to merge 5 commits into
mainfrom
add-page-title-ivar
Draft

Set page title from @page_title instance variable#25
raghubetina wants to merge 5 commits into
mainfrom
add-page-title-ivar

Conversation

@raghubetina

Copy link
Copy Markdown
Contributor

What

Change the application layout <title> to read from an @page_title instance variable:

<title><%= @page_title || "Default title" %></title>

Previously it used content_for(:title) || "Rails 8 Template".

Why

Controllers can assign @page_title directly in an action, which is simpler than threading the value through content_for/yield from each view. The fallback "Default title" is used for any action that does not set one.

Notes for discussion

  • The fallback string changed from "Rails 8 Template" to "Default title". If we want to keep the existing branded fallback, we should swap that back in.
  • This is a proposal — switching from content_for to an instance variable is a convention change worth a quick review before merging.

Configure Puma to run in single mode by default to save memory. Set MALLOC_ARENA_MAX to 2 to reduce fragmentation. Enable Solid Queue in Puma to avoid extra worker processes.
Includes recommendations from perf_4.md and previous analyses:
- Consolidate DB production pools (perf_2.md, perf_4.md)
- Force Puma single mode via WEB_CONCURRENCY=1 (perf_1.md, perf_4.md)
- Enable Solid Queue in Puma for durable jobs (perf_1.md, perf_4.md)
- Tune MALLOC_ARENA_MAX=2 (perf_1.md, perf_4.md)
- Move dev/test gems out of default group (perf_3.md)
- Robust ENV handling in Puma and boot scripts
Switch the layout <title> to read from an @page_title instance
variable, falling back to "Default title" when a controller action
does not assign one.

Controllers can set @page_title directly, which is simpler than
threading the value through content_for/yield from each view.
@raghubetina

Copy link
Copy Markdown
Contributor Author

A note: Rodauth defaults to setting page titles in @page_title.

@raghubetina raghubetina marked this pull request as draft May 26, 2026 23:21
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