Sign in

Help with adding custom option

  • This topic has 2 replies, 2 voices, and was last updated 1 year, 5 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7295
    Avatar photoGasmoN

    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/

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #7299
    Avatar photoGasmoN

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.