Skip to content
This repository was archived by the owner on Jun 14, 2026. It is now read-only.
This repository was archived by the owner on Jun 14, 2026. It is now read-only.

Allow for absolute titles to be specified in the routesConfig #4

Description

@isleshocky77

It would be nice to be able to state in the config whether the title will be using parent titles and dividers or to specify an absolute title to be used without generation.

An example could be something like this

import RouterTitle from 'react-router-title';
import { Router } from 'react-router-dom';

const routes = [
  {
    title: "Welcome to Example Company! The best company around!",  // Would be this exactly
    component: Homepage,
    routes: [
      {
        title: "Widgets", // NOTE: Title would be "Widgets | Example Company"
        path: "/widgets",
        component: Widgets,
        routes: [
          {
            title: "Grand Child", // NOTE: Title would be "Grand Child | Widgets | Example Company"
            path: "/widgets/:id/grand-child",
            component: GrandChild
          },
          {
            title: "Need Help with widgets? | Example Company", // NOTE: Title would be "Need Help with widgets? | Example Company"
            path: "/widgets/help",
            component: WidgetHelp
          }
        ]
      }
    ]
  }
];

const App = () => (
  <Router>
    <RouterTitle pageTitle="Example Company" routesConfig={routes} divider="|" />
    {/* your routes */}
  </Router>
);

export default App;

A solution could

  • Different property such as absoluteTitle with title excluded
  • Modifier such as titleConcat: 0 meaning don't concat the above N levels (would be nice for the last route example)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions