diff --git a/app/post_metadata.go b/app/post_metadata.go index 143fe6eb95..8b4a89b913 100644 --- a/app/post_metadata.go +++ b/app/post_metadata.go @@ -316,6 +316,10 @@ func getFirstLinkAndImages(str string) (string, []string) { if firstLink == "" { firstLink = v.Destination() } + case *markdown.InlineLink: + if firstLink == "" { + firstLink = v.Destination() + } case *markdown.InlineImage: images = append(images, v.Destination()) case *markdown.ReferenceImage: diff --git a/app/post_metadata_test.go b/app/post_metadata_test.go index bc6cf706d9..0d494e4182 100644 --- a/app/post_metadata_test.go +++ b/app/post_metadata_test.go @@ -1280,11 +1280,11 @@ func TestGetFirstLinkAndImages(t *testing.T) { ExpectedFirstLink: "https://example.com", ExpectedImages: []string{"https://example.com/logo"}, }, - "markdown links (not returned)": { + "markdown links": { Input: `this is a [our page](http://example.com) and [another page][] [another page]: http://www.exaple.com/another_page`, - ExpectedFirstLink: "", + ExpectedFirstLink: "http://example.com", ExpectedImages: []string{}, }, } {