Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Help with adding custom option

  • #7295
    Avatar photo[anonymous]

    I managed to add “Read More” option fo technews theme. So now if I toggle it ON it will show, and if it’s OFF it won’t show.

         {{#if @config.custom.feedReadMore}}
    Read More
         {{/if}}

    All works great, now I want to add when to show that “Read More” link. For example if text exceed 20 characters.
    How can I compare that in template? What is condition for checking if string exceed X amount of characters?

    This is the code for showing content from the post.

    {{#if hasCustomExcerpt}}
       {{{ excerpt }}}
    {{else}}
       <p>{{{ excerpt }}}</p>
    {{/if}}
    #7297
    Avatar photoBob

    Why not set the excerpt length to 20?

    In the case when you need a different excerpts length look at this solution: https://getpublii.com/dev/excerpts-with-variable-length/

    #7299
    Avatar photo[anonymous]

    Thank you. But is there any way to show “Read More” button only if excerpt exceed given lengh?