A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Allow setting same-tab and hide-arrow on bookmark groups
Svilen Markoveb86c3fb7930
diff --git a/docs/configuration.md b/docs/configuration.mdindex 2c1b924..eab54bc 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -1481,6 +1481,12 @@ An array of groups which can optionally have a title and a custom color.| title | string | no | || color | HSL | no | the primary color of the theme || links | array | yes | |+| same-tab | boolean | no | false |+| hide-arrow | boolean | no | false |++> [!TIP]+>+> You can set `same-tab` and `hide-arrow` either on the group which will apply them to all links in that group, or on each individual link which will override the value set on the group.###### Properties for each link| Name | Type | Required | Default |diff --git a/internal/glance/widget-bookmarks.go b/internal/glance/widget-bookmarks.goindex 3c7a69c..d55b818 100644--- a/internal/glance/widget-bookmarks.go+++ b/internal/glance/widget-bookmarks.go@@ -10,20 +10,48 @@ type bookmarksWidget struct {widgetBase `yaml:",inline"`cachedHTML template.HTML `yaml:"-"`Groups []struct {- Title string `yaml:"title"`- Color *hslColorField `yaml:"color"`- Links []struct {- Title string `yaml:"title"`- URL string `yaml:"url"`- Icon customIconField `yaml:"icon"`- SameTab bool `yaml:"same-tab"`- HideArrow bool `yaml:"hide-arrow"`+ Title string `yaml:"title"`+ Color *hslColorField `yaml:"color"`+ SameTab bool `yaml:"same-tab"`+ HideArrow bool `yaml:"hide-arrow"`+ Links []struct {+ Title string `yaml:"title"`+ URL string `yaml:"url"`+ Icon customIconField `yaml:"icon"`+ // we need a pointer to bool to know whether a value was provided,+ // however there's no way to dereference a pointer in a template so+ // {{ if not .SameTab }} would return true for any non-nil pointer+ // which leaves us with no way of checking if the value is true or+ // false, hence the duplicated fields below+ SameTabRaw *bool `yaml:"same-tab"`+ SameTab bool `yaml:"-"`+ HideArrowRaw *bool `yaml:"hide-arrow"`+ HideArrow bool `yaml:"-"`} `yaml:"links"`} `yaml:"groups"`}func (widget *bookmarksWidget) initialize() error {widget.withTitle("Bookmarks").withError(nil)++ for g := range widget.Groups {+ group := &widget.Groups[g]+ for l := range group.Links {+ link := &group.Links[l]+ if link.SameTabRaw == nil {+ link.SameTab = group.SameTab+ } else {+ link.SameTab = *link.SameTabRaw+ }++ if link.HideArrowRaw == nil {+ link.HideArrow = group.HideArrow+ } else {+ link.HideArrow = *link.HideArrowRaw+ }+ }+ }+widget.cachedHTML = widget.renderTemplate(widget, bookmarksWidgetTemplate)return nil