Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to add URL variable to template #185

Closed
clipcarl opened this issue Dec 17, 2023 · 10 comments
Closed

Patch to add URL variable to template #185

clipcarl opened this issue Dec 17, 2023 · 10 comments

Comments

@clipcarl
Copy link

clipcarl commented Dec 17, 2023

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

@slurdge
Copy link
Owner

slurdge commented 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 ?

@clipcarl
Copy link
Author

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.

@slurdge
Copy link
Owner

slurdge commented 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.

@slurdge slurdge reopened this Dec 18, 2023
@slurdge
Copy link
Owner

slurdge commented Dec 18, 2023

Also, is this the same as #104 ?

@clipcarl
Copy link
Author

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.

@slurdge
Copy link
Owner

slurdge commented 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.

@clipcarl
Copy link
Author

clipcarl commented 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!

@slurdge
Copy link
Owner

slurdge commented 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 #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.

@slurdge
Copy link
Owner

slurdge commented Dec 18, 2023

Done in v0.18.0

@slurdge slurdge closed this as completed Dec 18, 2023
@clipcarl
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants