How can I edit sidebar links that are added with api.addCommunitySectionLink?

If the new links can’t be modified on the customize modal, I guess I’ll drop the idea of adding them for now. It just seems confusing to add a link that is elusive on the customize modal then.

However, I’d want the link (if added manually) be highlighted when on the related route, so I’ll add this now:

import { apiInitializer } from "discourse/lib/api";

export default apiInitializer("0.8", (api) => {
  const router = api.container.lookup("service:router");

  api.onPageChange(() => {
    const currentRoute = router.currentRoute.name;
    const customHomepageLink = document.querySelector(
      '.sidebar-section-link[href="/custom"]'
    );

    if (currentRoute === "discovery.custom") {
      if (customHomepageLink) {
        customHomepageLink.classList.add("active");
      }
    } else {
      if (customHomepageLink) {
        customHomepageLink.classList.remove("active");
      }
    }
  });
});