[GH-ISSUE #185] Patch to add URL variable to template #36

Closed
opened 2026-09-29 12:58:52 +00:00 by slurdge · 10 comments
Owner

Originally created by @clipcarl on GitHub (Dec 17, 2023).
Original GitHub issue: https://github.com/slurdge/goeland/issues/185

The attached huge and complicated patch adds a URL variable for use in the email template to allow for adding a clickable link to to the original article like so:

<a href="{{.URL}}">{{.EntryTitle}}</a>

Patch:

diff -urN goeland-0.16.0.dist/cmd/run.go goeland-0.16.0.cet/cmd/run.go
--- goeland-0.16.0.dist/cmd/run.go	2023-10-27 07:34:30.000000000 -0700
+++ goeland-0.16.0.cet/cmd/run.go	2023-12-16 01:56:03.808909272 -0800
@@ -160,6 +160,7 @@
 		EntryFooter   string
 		ContentID     string
 		CSS           string
+		URL           string
 	}{
 		EntryTitle:    html.EscapeString(entry.Title),
 		EntryContent:  entry.Content,
@@ -169,6 +170,7 @@
 		EntryFooter:   footer,
 		ContentID:     "cid:" + logoAttachmentName,
 		CSS:           defaultCSS,
+		URL:           entry.URL,
 	}
 	if destination == "htmlfile" {
 		data.ContentID = "data:image/png;base64," + base64.StdEncoding.EncodeToString(logoBytes)

goeland-add_url_var.patch.txt

Originally created by @clipcarl on GitHub (Dec 17, 2023). Original GitHub issue: https://github.com/slurdge/goeland/issues/185 The attached huge and complicated patch adds a URL variable for use in the email template to allow for adding a clickable link to to the original article like so: ``` <a href="{{.URL}}">{{.EntryTitle}}</a> ``` Patch: ``` diff -urN goeland-0.16.0.dist/cmd/run.go goeland-0.16.0.cet/cmd/run.go --- goeland-0.16.0.dist/cmd/run.go 2023-10-27 07:34:30.000000000 -0700 +++ goeland-0.16.0.cet/cmd/run.go 2023-12-16 01:56:03.808909272 -0800 @@ -160,6 +160,7 @@ EntryFooter string ContentID string CSS string + URL string }{ EntryTitle: html.EscapeString(entry.Title), EntryContent: entry.Content, @@ -169,6 +170,7 @@ EntryFooter: footer, ContentID: "cid:" + logoAttachmentName, CSS: defaultCSS, + URL: entry.URL, } if destination == "htmlfile" { data.ContentID = "data:image/png;base64," + base64.StdEncoding.EncodeToString(logoBytes) ``` [goeland-add_url_var.patch.txt](https://github.com/slurdge/goeland/files/13694788/goeland-add_url_var.patch.txt)
Author
Owner

@slurdge commented on GitHub (Dec 17, 2023):

Hello, it seems exactly like this one : https://github.com/slurdge/goeland/pull/178/commits

I'm still confused on what is the expected output compared to use the "IncludeLink" filter. Could you show me an example ?

<!-- gh-comment-id:1859198289 --> @slurdge commented on GitHub (Dec 17, 2023): Hello, it seems exactly like this one : https://github.com/slurdge/goeland/pull/178/commits I'm still confused on what is the expected output compared to use the "IncludeLink" filter. Could you show me an example ?
Author
Owner

@clipcarl commented on GitHub (Dec 18, 2023):

Hello, it seems exactly like this one : https://github.com/slurdge/goeland/pull/178/commits

So it does! I guess someone else beat me to it. I'll close this one then.

<!-- gh-comment-id:1859845306 --> @clipcarl commented on GitHub (Dec 18, 2023): > Hello, it seems exactly like this one : https://github.com/slurdge/goeland/pull/178/commits So it does! I guess someone else beat me to it. I'll close this one then.
Author
Owner

@slurdge commented on GitHub (Dec 18, 2023):

Wait ! I still don't understand the goal :-) So I won't merge it until I grasp the best way to achieve what is needed. Please comment either here or on the pull request.
Ideally show me a screenshot and/or html of what you want to achieve.

<!-- gh-comment-id:1859946943 --> @slurdge commented on GitHub (Dec 18, 2023): Wait ! I still don't understand the goal :-) So I won't merge it until I grasp the best way to achieve what is needed. Please comment either here or on the pull request. Ideally show me a screenshot and/or html of what you want to achieve.
Author
Owner

@slurdge commented on GitHub (Dec 18, 2023):

Also, is this the same as https://github.com/slurdge/goeland/discussions/104 ?

<!-- gh-comment-id:1859952061 --> @slurdge commented on GitHub (Dec 18, 2023): Also, is this the same as https://github.com/slurdge/goeland/discussions/104 ?
Author
Owner

@clipcarl commented on GitHub (Dec 18, 2023):

The goal is to allow for adding a clickable link to to the original article in the email generated by goeland. It is the same as #178 and #104 .

The documentation suggests that IncludeLink only works when generating digests. I wish to add the link when not using digests.

<!-- gh-comment-id:1860033578 --> @clipcarl commented on GitHub (Dec 18, 2023): The goal is to allow for adding a clickable link to to the original article in the email generated by goeland. It is the same as #178 and #104 . The documentation suggests that IncludeLink only works when generating digests. I wish to add the link when not using digests.
Author
Owner

@slurdge commented on GitHub (Dec 18, 2023):

Ah ! So you mean, take a source, have one email per entry, and each entry has the link back to the website ? Basically, let's say 10x the emails, and each <h1> has a link right ?
If so I think I can make inclueLink work all the time.

<!-- gh-comment-id:1860037454 --> @slurdge commented on GitHub (Dec 18, 2023): Ah ! So you mean, take a source, have _one email per entry_, and each entry has the link back to the website ? Basically, let's say 10x the emails, and each `<h1>` has a link right ? If so I think I can make inclueLink work all the time.
Author
Owner

@clipcarl commented on GitHub (Dec 18, 2023):

So you mean, take a source, have one email per entry, and each entry has the link back to the website ?

Yes. One generated email for each RSS article and the generated email has a link to the full article.

... each <h1> has a link right ? If so I think I can make inclueLink work all the time.

I customize the style of the link and its placement in the email's template so if IncludeLink automatically adds something like <h1> that wouldn't work for me. Also I'm not sure if IncludeLink would allow for customizing the location of the link in the email which I also do.

My preference would be to have #178 even if you do change IncludeLink.

Thanks!

<!-- gh-comment-id:1860071262 --> @clipcarl commented on GitHub (Dec 18, 2023): > So you mean, take a source, have one email per entry, and each entry has the link back to the website ? Yes. One generated email for each RSS article and the generated email has a link to the full article. > ... each `<h1>` has a link right ? If so I think I can make inclueLink work all the time. I customize the style of the link and its placement in the email's template so if IncludeLink automatically adds something like ` <h1>` that wouldn't work for me. Also I'm not sure if IncludeLink would allow for customizing the location of the link in the email which I also do. My preference would be to have #178 even if you do change IncludeLink. Thanks!
Author
Owner

@slurdge commented on GitHub (Dec 18, 2023):

if IncludeLink automatically adds something like <h1> that wouldn't work for me.

Yeah that would do exactly that.

My preference would be to have https://github.com/slurdge/goeland/pull/178 even if you do change IncludeLink.

I understand. I'll merge the PR but not the bit that changes the default template.

Also, if you have nice email templates, feel free to share them, I'm always hoping to add more.

<!-- gh-comment-id:1860204368 --> @slurdge commented on GitHub (Dec 18, 2023): > if IncludeLink automatically adds something like `<h1>` that wouldn't work for me. Yeah that would do exactly that. > My preference would be to have https://github.com/slurdge/goeland/pull/178 even if you do change IncludeLink. I understand. I'll merge the PR but not the bit that changes the default template. Also, if you have nice email templates, feel free to share them, I'm always hoping to add more.
Author
Owner

@slurdge commented on GitHub (Dec 18, 2023):

Done in v0.18.0

<!-- gh-comment-id:1860863833 --> @slurdge commented on GitHub (Dec 18, 2023): Done in v0.18.0
Author
Owner

@clipcarl commented on GitHub (Dec 18, 2023):

Thank you!

<!-- gh-comment-id:1861432134 --> @clipcarl commented on GitHub (Dec 18, 2023): Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: slurdge/goeland#36
No description provided.