Skip to content

Commit

Permalink
fix: handle non-string ID in navigation links
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishb committed Mar 27, 2024
1 parent cbc1b75 commit 261005a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/wp2hugo/internal/wpparser/wp_parser_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,12 @@ func getNavigationLinks(content string) ([]NavigationLink, error) {
*/
func getNavigationLink(match string) (*NavigationLink, error) {
type _NavigationLink struct {
ClassName string `json:"className"`
Description string `json:"description"`
ID string `json:"id"`
Kind string `json:"kind"`
Label string `json:"label"`
OpensInNewTab bool `json:"opensInNewTab"`
Rel string `json:"rel"`
Title string `json:"title"`
Type string `json:"type"`
URL string `json:"url"`
// Note that ID is string in ashishb.net export but is int in some other exports
// https://github.com/ashishb/wp2hugo/issues/9
Label string `json:"label"`
Title string `json:"title"`
Type string `json:"type"`
URL string `json:"url"`
}
var navLink _NavigationLink
if err := json.Unmarshal([]byte(match), &navLink); err != nil {
Expand Down

0 comments on commit 261005a

Please sign in to comment.