Skip to content

Add page titles to catalog and Workflow apps#261

Merged
notartom merged 3 commits into
LibriVox:masterfrom
redrun45:page-titles
Jun 1, 2025
Merged

Add page titles to catalog and Workflow apps#261
notartom merged 3 commits into
LibriVox:masterfrom
redrun45:page-titles

Conversation

@redrun45

@redrun45 redrun45 commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator

Adds dynamic HTML -> head -> title elements to all pages. No more tabs that are just called 'LibriVox'! 😉

  • First commit deals with the catalog pages, which already share a common 'partials/header' view that we can adjust. Simple enough!
  • Second commit is a tiny refactor for Private_Controller, so that private pages will share code like the catalog pages do. This doesn't actually change behavior yet, just makes it easy for later...
  • Third commit adds titles to those private pages! Also adds titles to Uploader, Template Generator, and Login pages - those haven't been refactored, so you'll see some duplication of common code there.

redrun45 added 3 commits May 31, 2025 15:03
Update `application/views/catalog/partials/header.php`
Replaced just "LibriVox" as the HTML->head->title with the following:
`<page title or 'Browse Catalog'> | LibriVox`

Update `application/controllers/catalog/*`
Set titles for the following types of pages:
* Author pages: `Works by <author name>`
* Group pages: `Works in "<group name>"` (including quotes)
* Keywords pages: `Works tagged with "<keywords value>"` (including quotes)
* Project pages: `<book/project title>`
* Reader pages: `Works read by <reader name>`
* Reader section details sub-pages: `Section details for <reader name>`

All other pages (searching, browsing by language, etc.) will use the default.

Update `application/views/catalog/page.php`
Use the title that was generated from the Page controller, instead of
 calling that helper function again from here.
This will save us some boilerplate code in all the Private_Controller
 sub-classes, when we go to add page titles to HTML->head.

I'm leaving Public_Controller alone for now, since it has fewer sub-classes.
Adds page titles to the rest of `application/controllers/`.  As with the
 catalog, each will have " | LibriVox" tacked on the end.

The goal was to have each title match the link that took you to the page...
 with a few exceptions.
* Admin pages are 'X Manager', rather than 'Edit X' or 'Manage X'.
* Controllers that work with specific items (projects, authors, etc.) should
  show the name of the item they're currently working with, if any (e.g.,
  `The Betrothal | Section Compiler | LibriVox`)
* 'Uploader' and 'Project Template Generator' are referred to by those names.
Comment on lines -54 to +63
if ($project_translators) $results_to_cast = array_merge($results_to_cast, $project_translators);
if ($project_translators) $results_to_cast = array_merge($results_to_cast, $project_translators);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

White-space fix! Nothing to see here. 😉

@notartom

notartom commented Jun 1, 2025

Copy link
Copy Markdown
Member

I don't want to make perfect the enemy of good enough, but this is the kind of thing that can easily have its own tests, even with our currently wonky test DB setup. Maybe in a follow up patch? :)

@notartom notartom merged commit 095fd3d into LibriVox:master Jun 1, 2025
1 check passed
@redrun45 redrun45 deleted the page-titles branch June 1, 2025 13:58
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