Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

title configuration should accept a (formatting) function as an option #655

Closed
1 of 5 tasks
thescientist13 opened this issue Jul 7, 2021 · 2 comments · Fixed by #646 or #892
Closed
1 of 5 tasks

title configuration should accept a (formatting) function as an option #655

thescientist13 opened this issue Jul 7, 2021 · 2 comments · Fixed by #646 or #892
Labels
enhancement Improve something existing (e.g. no docs, new APIs, etc) good first issue Good for newcomers
Milestone

Comments

@thescientist13
Copy link
Member

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Thought of this in #646 that instead of just a string for title in greenwood.config.js, a function could be used as well for custom title formatting.

Not sure if this "conflicts" at all #304 , but having an easy to do this from the config file alone seems useful on its own.

Details

So instead of only being able to provide a string (or having to do it dynamically with JavaScript in your app)

module.exports = {
  title: 'Greenwood';
 }

You could now do something like this

module.exports = {
  title: (pageTitle = undefined) => {
    const title = 'Greenwood';
    
    return pageTitle === ''
      ? title
      :  `${title} - ${pageTitle}`
    }
 }
@thescientist13
Copy link
Member Author

I think with #871 this is no longer needed, as this can be enabled directly in HTML now. Also, per #851 , moving this out of config and HTML seems like the right move.

@thescientist13
Copy link
Member Author

Somewhat superseded by #871 so thinking this can be closed instead, but if more use cases are identified that make this valuable, happy to have it re-opened and championed by someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve something existing (e.g. no docs, new APIs, etc) good first issue Good for newcomers
Projects
No open projects
1 participant