I am trying to find the tpl for the teaser that is used in a digest notification. I think this might be what embeds into the token: [subs:items:index:#0:formatted]

the README states:

Digest mail template: Each digest item is formatted using the content type
of the item.

but i am fairly sure that is not correct.

Comments

karing’s picture

Are you looking for:
/admin/config/system/mail-edit

liquidcms’s picture

well, yes.. but the only thing that is there is the digest tpl, not the digest teaser tpl - i.e. the tpl of what is included in each snippet that gets sent for each node being digested.

karing’s picture

In the mail digest template there is the !teaser (Replacement pattern in Digest item: section). Not what you're looking for?

liquidcms’s picture

i would think the digest is of the form something like this:

---------------------
digest header stuff

list of digest teasers for items listed in digest

digest footer stuff
-----------------------

so i need to define what the teaser is.

ideally something like:

========
title, author
field1, field2
created
========

karing’s picture

Sorry for the confusion... !teaser was in D6. In D7 it's node:summary. It already exists - no need to define it. Use:
[subs:items:index:#0:as-node:summary] - and use the handy Preview template button at the bottom.

liquidcms’s picture

i don't mean teaser as in D6 terms.. i mean the snippet of text that is included for each item listed in the digest.. i.e. the teaser.

or are you saying the [subs:items:index:#0:as-node:summary] token is the teaser view mode (see Manage Display for a node type)? so i can add what ever fields i want to display there and this is my digest "teaser", then the tpl for this will be used as well; since sadly things like author, created date, etc are manageable in view modes.

OR let me go about this another way.. how do i add a field to show in the "digest teaser"?

karing’s picture

If you want eg the title, the author and the summary - then you can do this in the digest template:

{{[subs:items:count]#===================================================== #1 of [subs:items:count] {{[subs:items:index:#0:subs:is-new]?(new):}}{{[subs:items:index:#0:subs:is-updated]?(updated):}}{{[subs:items:index:#0:subs:is-old]?(commented):}}
[subs:items:index:#0:as-node:title]
[subs:items:index:#0:as-node:author]
[subs:items:index:#0:as-node:summary]
}}=====================================================

etc. just keep building - you can completely customize this.

Hoping this will help you.

liquidcms’s picture

i'll try one more time... how do i add a FIELD from the node to the digest teaser?

perhaps something like: [subs:items:index:#0:as-node:field_mycustomfield] ?

thanks for the help.

karing’s picture

OK, this is the first time you've used the word custom :-)

So to recap:

1. There is no digest teaser template. The template is called: digest template.

2. To use the digest template to output node summaries in your notifications instead of full nodes use:

[subs:items:index:#0:as-node:summary] 

3. If you like you can add both standard Drupal fields as well as custom fields that you've created yourself:

[subs:items:index:#0:as-node:title]
By: [subs:items:index:#0:as-node:author]
[subs:items:index:#0:as-node:field_slideshow_link]
[subs:items:index:#0:as-node:field_slideshow_order]
[subs:items:index:#0:as-node:summary]

In this example both field_slideshow_link and field_slideshow_order are the field (machine) names as shown in the Manage Fields tab of the Content Type these custom fields belong to.

liquidcms’s picture

ok, cool.. sorry for the confusion. will try this out.

the field we are trying to add seems simply enough as it is a simple textarea field; but curious as to how this would work for more complex fields that are multis or have other parts (like a link field has title and url). perhaps it uses the display formatter defined for some view mode (?); still seems to be a few pieces missing to this.. but will give it a shot.

karing’s picture

Not sure about more complex fields, but for a link - when using HTML - you'll automatically get:
<a href="Text in URL field">Text in Title field</a>
Just like on the node itself.

karing’s picture

Status: Active » Closed (works as designed)

I'll mark this as closed. Should you find anything is missing/not working when you add your custom fields, then please feel free to open another support (or feature) request.

mdu2’s picture

I am trying this as well. Thanks for the useful examples. Just one more question: couldn't figure out the token to render the comment text in case of a comment. Any idea how to do this?

I tried:

  • {{[subs:items:index:#0:subs:is-old]?[subs:items:index:#0:as-comment:body]:}}
  • {{[subs:items:index:#0:subs:is-old]?[subs:items:index:#0:as-node:comment]:}}
  • {{[subs:items:index:#0:subs:is-old]?[subs:items:index:#0:as-node:comment:body]:}}
karing’s picture

Check out the node-type-blog template to see the correct syntax for comment:author:name etc.

If you're going to mix-and-match (so your digest contains a mixture of content-types) then try this:

1. Add a template for all content-types that may be involved - and configure each of them.
2. Use :formatted in the digest template - which will use the template for the item as if the item were sent as a single message.

I've not tried this myself yet - but I've been told - reliable source - this should work!

mdu2’s picture

Good hint with the mix-and-match but I am not sure how this works. In the mail-templates (admin backend) I have one for the digest and several other for other types. When I "Add" one of the non-digest templates I get the same template-content as I see when using the :formatted in the items-loop of the digest but with "Welcome .... blabla" around it. Are these templates used in the digest when using the :formatted notation but stripped of the welcome-stuff? How does this work/fit together?

Update: Didn't get the comment-thing in the digest work. Seems I am to stupid for this... :/ Where do all those default templates / formattings come from (the one with the ASCII-Arts style content?

karing’s picture

Ok, let me illustrate this with an example as well:

in digest template
[subs:items:index:#0:formatted]

in a node-type-[your content type] template:
make an Edit
eg. change
Author: [user:name]
to
By THIS Author: [user:name]
save/update this

go back to your digest template
Hit Preview template -> voila there you'll now find it now displays the Author bit as:
By THIS Author

Sel_Space’s picture

Status: Closed (works as designed) » Active

I can't find the teaser token in digest template , I've tried this token [subs:items:index:#0:as-node:summary] , but it's not working

salvis’s picture

See the Subscriptions front page for why [node:summary] is not working and what you can do about it.

Sel_Space’s picture

Now I have another problem , [node:summary] is working for some content type but not for the others

salvis’s picture

Status: Active » Closed (works as designed)
salvis’s picture

If anyone is interested, the Fix Core module now has a fix for the empty [node:summary] token.

bdarshu’s picture

Issue summary: View changes

How can I use tocken for node reference field? I mean, suppose I am having a field which is Node reference field and that field I want to use in Digest mail. How can I write the token for the same?