I have been using router and discovery to create a dynamic hero depending what page is showing, however when i get down to and individual topic page I cannot find a way to pass the topic title to the template.
Is there a way to retrieve the topic title here?
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import { defaultHomepage } from "discourse/lib/utilities";
export default class BcnHero extends Component {
@service router;
@service discovery;
get showHero() {
const { currentRouteName} = this.router;
const { category } = this.discovery;
let categoryName = ""
let categoryDescription = ""
if (category) {
categoryName = category.name
categoryDescription = category.description
}
if (currentRouteName === `discovery.${defaultHomepage()}`) {
return { homepageHero: true }
}
if (currentRouteName === "discovery.category" || currentRouteName.startsWith("topic")) {
return { dynamicHero: true, title: categoryName, subtitle: categoryDescription }
}
return { emptyHero: true }
}
}