0
Welcome Guest! Login
0 items Join Now

Swiper article text hyperlink?

  • Swiper article text hyperlink?

    Posted 9 months 2 weeks ago
    • I'm using the Swiper particle in Joomla 4, to display an image and text from a Joomla article. The only problem I'm having is that I want to use a hyperlink in the Joomla article text. When the swiper is displayed the hyperlink is stripped out. Is there a way to keep this from happening?
    • Matt's Avatar
    • Matt
    • Preeminent Rocketeer
    • Posts: 21585
    • Thanks: 3095
    • messin' with stuff

    Re: Swiper article text hyperlink?

    Posted 9 months 2 weeks ago
    • The Particle is set to pull in 'raw' text in already which should include HTML formatting.

      /particles/swiper.joomla.html.twig line 71
      {% if display.text.type != '' %}
          <div class="g-swiper-text">
              {% set article_text = display.text.type == 'intro' ? article.introtext: article.text %}
              {{ article_text|truncate_text(display.text.limit)|raw }}
          </div>
      {% endif %}

      If you set your text length (Articles Display > Text Limit) to more characters than the article... put a bunch of 9s in there... does it work?

      I think the 'truncate_text' portion might be tripping it up... if truncate_text can't reach the closing tag of an HTML block I think it'll strip the HTML... so if your Text Limit is less than where the closing </a> tag would fall for example, it'll strip (I think) the <a href="#">....</a> HTML... it's possible if you have <p> tags wrapping your text and it can't reach a closing </p> tag within the Text Limit, it'll strip the HTML...

      Run some tests with an article that JUST contains a hyperlink and has an adequate character count set

      It's either that or Joomla is stripping the HTML when it's passed to the Particle.
    • Last Edit: 9 months 1 week ago by Matt.
    • SEARCH the forum first! These boards are rich in knowledge and vast in topics. This includes searching just the 'Solved' forums, using Google, and using ChatGPT :woohoo:
  • Re: Swiper article text hyperlink?

    Posted 9 months 1 week ago
    • Thanks Matt. I did as you suggested with no luck. My article was already quite short (just a sentance). I did increase the text limit (from blank to 99999). For accessibility reasons I'd rather code the hyperlink myself than rely on Joomla's article links.
    • Matt's Avatar
    • Matt
    • Preeminent Rocketeer
    • Posts: 21585
    • Thanks: 3095
    • messin' with stuff

    Re: Swiper article text hyperlink?

    Posted 9 months 1 week ago
    • If you change (backup the file first)
      {{ article_text|truncate_text(display.text.limit)|raw }}

      to
      {{ article_text|raw }}

      Does it work?

      what about:
      {{ article.text|raw }}
    • Last Edit: 9 months 1 week ago by Matt.
    • SEARCH the forum first! These boards are rich in knowledge and vast in topics. This includes searching just the 'Solved' forums, using Google, and using ChatGPT :woohoo:

Time to create page: 0.035 seconds