This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1009 from parameter1/newsletter-stealth-link
Add newsletter stealth link component
- Loading branch information
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { get } from "@parameter1/base-cms-object-path"; | ||
import defaultValue from "@parameter1/base-cms-marko-core/utils/default-value"; | ||
import moment from "moment"; | ||
|
||
$ const { newsletter, date } = input; | ||
|
||
$ const newsletterSiteName = get(newsletter, "site.name") || "Homepage"; | ||
$ const linkText = defaultValue(input.linkText, newsletterSiteName); | ||
$ const unixTimestamp = moment(date).unix(); | ||
$ const position = defaultValue(input.position, "top"); | ||
$ const linkUrl = `${newsletter.site.origin}/email-preview?newsletterId=${newsletter.id}×tamp=${unixTimestamp}&position=${position}`; | ||
|
||
<div name="divPreviewLink" style="display:none;height:0px;width:0px;overflow:hidden;visibility:hidden;mso-hide:all"> | ||
<a href=linkUrl>${linkText}</a> | ||
</div> |