Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#271 2025-02-23 18:22:47

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

The plugin is installed, activated, but does not want to work. Is it possible to edit/update it somehow?
textpattern 4.9.0b1
(Need to leave 3 paragraphs in excerpt)

Offline

#272 2025-02-23 21:50:47

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

I gave etc’s version a quick whirl with the following in place of the regular txp:excerpt tag, and it seems to still work on txp 4.9 and PHP 8.4.

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="3" />

Could it be that you already have article excerpts and need to include the attribute overrideexcerpt="1" to force it to autogenerate an excerpt?

If not, can you elaborate on your specific case?


TXP Builders – finely-crafted code, design and txp

Offline

#273 2025-02-24 10:16:36

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

Thank you very much jakob
I don’t know, maybe I made a mistake somewhere, maybe a quotation mark.
But now it works!

Offline

#274 2025-02-24 11:05:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

Glad it’s working. Here’s the above plugin (code unchanged) with cleaned up help:

# Name: rss_auto_excerpt v0.5.2
# Type: Public site only plugin
# Automatic article excerpts
# Author: Rob Sable
# URL: http://www.wilshireone.com/
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - https://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAE70Zf2/bxvXvCOh3uBBCRaUyJStx0siWG6/Ftm4tUCQuhs32hCN5kthQPIJH
RnarAv0O+3cD9ln2UfpJ9t67O/KoH44XpDMSm7x7v+79fkc+OR5PflKTZxMvkrHwTuHx5bOX
E+/yNp9MFqL0e9eX4rbMeVmKIru+5Ivr12KRqLK46/WPzgt6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N21AOU
lWv1GEJTT+U8q8nT8EvE6cmJGhPoDqrxZYs19fBCBF9rajSBby6YnsR1icpzgQNSKObSNHP3
isu+NgbSiPY2ppaFtQQhRlPviOmwci5qNl9hdlpBUVNoRFN6d5lbX7VOgTRySmcHLoja/gGW
py8DsRU02IwgPh1BbDC1v9Xca8+a+Hy/OdukHItuX5B8qBJ0qiXf345naubrwAlFxMHVCWpv
E4Ipfyfft/MD6GtbbquzPXdRH+tIdevpCFufK9gct4UyQFNPZ9ytL3ibr+oGNNtD2fZdhz8b
1u0XKmOLeK0L++Vr8wafVO09ykm8O7zJs9pHQ31bWi3izfcxywKOD1aiZRpzce8DuTXEa571
F417yyuC2QQdCqj2GYaiCY33lB5kXnNp6qX9DnGoAn8ElqZCj2uGDyrSH4HxThFvfyS4t5B/
BPZuoW/lPWI8TwS2gdCPITtMHLbeb01uQY32qg6DqIIBeqWJUnJ7GEUtHiG80rlFEyLTUBP5
Wt9hOMNnawSz+c3008DGZjrojn/95Z/mCuTXX/7ldgaVsu3CDPUyw2vChNOFp9anaR3qggvN
w+9BdNOEwsgURgE7K2/zSTKfJdAevEviiqczc67zDtO7O5P1rhmY+/oSfjw2PO8QNl3/DA8T
2yKEaMN7ZOpQ/4M3yKblt15DdSwplEMRFUFjs7WUzJwhHHKPoo4rh2Z8wEBDZr9hW4NqELoB
J6ZKCLpLdLwbz5OXjRh60NUeTzk0IkwyeCjq9g16AbpfsGOwKu9Ssqskdtsn8pNABANoGooF
xNdcIkbyo+hjm1BnNQsVFzIHL8tVH4R5crk1sZEk+74E8OyOboub/B880W2nwUuh48QgyIE+
cIOiG6cmjlGnCpQpU7ziB5ik5GkSgYix7k8xyUuqqSopK04z/9aNRLSUKAamC8zr2PeQsveU
IxvMHXOThGFKN1HPJ962p9kLr1TyeGbumGBl4p3g36cTbxXrp/HEC0fz8fPjp8/iMHw5Gkfw
/+Tz8MU8isPPX4xfnnDv9Of/AiByqW/LJgAA

TXP Builders – finely-crafted code, design and txp

Offline

#275 2025-02-24 12:41:45

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

I would like to ask. I did it via javascript, before displaying in the browser all the images of the article are collected if they are in the article and moved to the created div with the class name .img__inner.

Is it possible to make it so that in excerpt there are only the first 3 paragraphs and one div with the name .img__inner
i.e. wherever the div block is in the list (let’s say 6 or 22), it would get into excerpt together with the first 3 paragraphs.
____________________________________________
<p>lorem</p>
<p>lorem</p>
<p>lorem</p>
<div class=“img__inner”>lorem</div>

Last edited by msome (2025-02-24 12:43:36)

Offline

#276 2025-02-24 15:13:43

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

msome wrote #339131:

Is it possible to make it so that in excerpt there are only the first 3 paragraphs and one div with the name .img__inner i.e. wherever the div block is in the list (let’s say 6 or 22), it would get into excerpt together with the first 3 paragraphs.

Maybe you could achieve this another way by leveraging Textpattern’s custom shortcodes. If you put the code that creates your image collection into a form – let’s say img_gallery –, then you can call that code using the tag <txp::img_gallery /> (with double-colons for a custom shortcode). You could use this tag in your article wherever you want to show the images, for example:

Lorem ipsum dolor sit amet

consectetur adipiscing elit

…

<txp::img_gallery />

sed do eiusmod

…

and in your article_list context, you could then do:

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="3" />
<txp::img_gallery />

If you’d rather place them in div containers with different classes, you could add an attribute class="img__inner" in your article and class="img__preview" in your article_list item (for example). In your shortcode’s code, you’d then have:

<div<txp:if_yield name="class"> class="<txp:yield name="class" />"</txp:if_yield>>
… your code …
</div>

and would call them with <txp::img_gallery class="img__inner" /> and <txp::img_gallery class="img__preview" /> respectively.


TXP Builders – finely-crafted code, design and txp

Offline

#277 2025-02-24 18:10:24

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

Thanks for the answer!

The html page is generated in this format, already with the help of my script, at this stage everything is ok, the images are placed where they should be, ok.

The images are put in “textarea” manually via the button on the panel (arrow in the screenshot).
You need to delete all paragraphs/divs except the first two and the last one.

admin panel

website

Of course, this can be done via CSS, but I would not want to. So that initially unnecessary content is not loaded into “except”.

<txp::img_gallery /> does not show the presence of images in the article added in this way.

Last edited by msome (2025-02-24 18:34:50)

Offline

#278 2025-02-24 21:31:05

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

Okay, got you. You’re using something else (tinyMCE?) to generate direct HTML for your body so shortcodes won’t be processed. I guess you could add another option to rss_auto_excerpt but it’s a very specific case.

How about this for an alternative suggestion? It’s similar to the previous idea but uses etc_query to retrieve the div node with the images in it and tag it on the end of the rss_auto_excerpt. You’ll first need to install etc_query.

Then try a setup like this in your article_list code:

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="2" showlinkwithexcerpt="0" />
<txp:etc_query data='<txp:body />' query="//div[@class='img_inner']" />
<txp:permlink>Keep reading …</txp:permlink>

This is the rss_auto_excerpt tag with however many paragraphs you want. I added showlinkwithexcerpt="0" to suppress the “Keep reading …” link after the paragraphs.

Then etc_query retrieves your div with your specific class from within the article body using XPath syntax.

The “Keep reading…” is then added back in at the end using txp:permlink.

I tried this out with a manually input html only body text and it worked nicely:

and


TXP Builders – finely-crafted code, design and txp

Offline

#279 2025-02-25 13:06:00

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

Thanks for the help jakob!
Yes, it works in manual mode.

But I have it connected in the footer <script src=“script.js” defer></script>
This script creates a div.img__inner block and all the images of the article are moved there.

But I can’t make it work like that, maybe the script starts working before the page is rendered…

Offline

#280 2025-02-25 13:46:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

Both rss_auto_excerpt and etc_query (in the way shown above) act on the content of the Textpattern’s article body as it comes out of the database (e.g. the body_html field in the database) and then renders that to the page. They have no knowledge of what might subsequently be re-rendered with javascript after the page loads, so I don’t think either plugin can help you there.

Can you perhaps solve it differently without using javascript? You said that the script collects all the article images and renders them inside a div.img__inner. Where are your article images inserted?

  • If they are in the article_image field, you could use the regular txp:images tag to render the images from there.
  • If they are inserted individually at different places in your article body using TinyMCE, maybe try the etc_query method above but adjust the XPath search query to grab all the images inside the article. Then wrap them in your page template or form with the div you want.

For example:

<!-- rewrap all images from within the 'img__inner' class -->
<txp:etc_query data='<txp:body />' query="//div[@class='img__inner']/img" wraptag="div" class="img__items" />

<!-- rewrap all images from the article body -->
<txp:etc_query data='<txp:body />' query="//img" wraptag="div" class="img__items" />

will retrieve just the img tags and rewrap them in a div with class img__items.

Maybe you don’t need your javascript at all after that.


TXP Builders – finely-crafted code, design and txp

Offline

#281 2025-02-25 15:44:00

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

Now the images are transferred to div.item__images, which is now created by the etc_query plugin

But for some reason the images are duplicated…

default form:

<txp:if_article_list>
  <div class="main__content-item item">
    <p class="item-title">
      <txp:permlink class="item__title-link"><txp:title /></txp:permlink>
    </p> 
    <txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="2" showlinkwithexcerpt="0" />
    <txp:etc_query data='<txp:body />' query="//img" wraptag="div" class="item__images" />
  </div>
<txp:else />
  <div class="main__content-item item">
    <p class="item-title">
      <txp:permlink class="item__title-link"><txp:title /></txp:permlink>
    </p>
    <txp:body />
    <txp:excerpt />  
    <txp:etc_query data='<txp:body />' query="//img" wraptag="div" class="item__images" />
  </div>
</txp:if_article_list>

Last edited by msome (2025-02-25 15:44:41)

Offline

#282 2025-02-25 17:14:47

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

Looks good. If the duplication is happening in the individual article view, then I guess it is because you have <txp:body /> and <txp:etc_query data='txp:body />' …. See what your source code looks like.

Otherwise I’m not sure. I presume you don’t have the same image twice in the article? My Xpath knowledge is rudimentary, so maybe you can tweak the query. There are tutorials online, and the web inspector can also help in telling you the Xpath for a DOM node.


TXP Builders – finely-crafted code, design and txp

Offline

#283 2025-02-25 21:49:09

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="2" showlinkwithexcerpt="0" />
<txp:etc_query data='<txp:body />' query="//img" wraptag="div" class="item__images" />

Yes, let’s say there is an image in the article in paragraph 1 or 2.

a) It is displayed here.

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="2" showlinkwithexcerpt="0" />

b) And it is displayed here.

<txp:etc_query data='<txp:body />' query="//img" wraptag="div" class="item__images" />

If you remove a) there will be no article text.
If you remove b) a div with all the images from the article (body) will not be created

Offline

#284 2025-02-25 22:00:52

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,188
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

msome wrote #339144:

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="2" showlinkwithexcerpt="0" />...

Yes, let’s say there is an image in the article in paragraph 1 or 2.

Hmm. Try adding escape="img" to the rss_auto_excerpt tag:

<txp:rss_auto_excerpt overrideexcerpt="1" paragraphs="2" showlinkwithexcerpt="0" escape="img" />

The idea here is to strip image tags out of the first instance of the body. See the docs – using img is the escape="some-tag" option in that list.


TXP Builders – finely-crafted code, design and txp

Offline

#285 2025-02-26 17:29:17

msome
Member
Registered: 2015-09-16
Posts: 40

Re: [plugin] [ORPHAN] rss_auto_excerpt

Yes, it worked! Hooray, well done! Thanks!

Offline

Board footer

Powered by FluxBB