# Problem with kirbytext() is duplicating tags

**URL:** <https://forum.getkirby.com/t/problem-with-kirbytext-is-duplicating-tags/19132>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 21, 2020, 2:23am UTC](https://forum.getkirby.com/t/problem-with-kirbytext-is-duplicating-tags/19132 "2020-08-21T02:23:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sashagirl](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sashagirl/32/7478_2.png) [@sashagirl](https://forum.getkirby.com/u/sashagirl)\
**Post date:** [August 21, 2020, 2:23am UTC](https://forum.getkirby.com/t/problem-with-kirbytext-is-duplicating-tags/19132/1 "2020-08-21T02:23:37Z")

</div>

I’m having issues with rendering markdown onto the frontend - I can’t understand what is happening but the code is duplicating tags and classes that destroy my grid. This is illustrated in the image below where the project on top has no markdown whereas the bottom one has link created in kirby panel - (link: [https://www.transitionsfilmfestival.com/event/ranger-to-ranger/](https://www.transitionsfilmfestival.com/event/ranger-to-ranger/) text: here)

 ![Screen Shot 2020-08-21 at 12.18.29 pm](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/1/18c4145bc45fdd7861792c640181ac584e907d1c.png)

When inspecting the code it shows that the tag with ‘news\_wrapper’ class has been duplicated

 

![Screen Shot 2020-08-21 at 12.31.35 pm](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/c/cf57105dc7e2eab25816628f2cc626654e40da6f.png)

 

```
  <a href="<?= $article->url() ?>" class="news__wrapper">
            <div class="news__inner gc">
                <div class="d-1-5 t-1-7 m-1-13">
                    <p style="--textcolor:<?= $page->textcolourpicker()->value(); ?>"><?= $article->title() ?></p>
                    <div class="news__image">
                        <?= $article->image()->crop(500, 350) ?>
                    </div>
                </div>

                <div class="d-5-7 t-1-7 m-1-13">
                    <p style="--textcolor:<?= $page->textcolourpicker()->value(); ?>"><?= $article->date() ?></p>
                </div>
                <div class="d-7-11 t-7-13 t-r-1 m-1-13" style="--textcolor:<?= $page->textcolourpicker()->value(); ?>">
                    <p style="--textcolor:<?= $page->textcolourpicker()->value(); ?>"><?= kirbytext($article->text()->short(550)) ?></p>
                </div>

                <div class="read_more d-11-13 t-7-13 m-1-13">
                    <span><p style="--textcolor:<?= $page->textcolourpicker()->value(); ?>">Read More</p>
                    </span>
                </div>
                </div>
            </a><!-- End of News Wrapper -->
```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 21, 2020, 4:30am UTC](https://forum.getkirby.com/t/problem-with-kirbytext-is-duplicating-tags/19132/2 "2020-08-21T04:30:31Z")

</div>

Hm, have to check, but using a link inside a link doesn’t make sense, anyway. Is this Kirby 2 or 3?

Unrelated side note: It is not valid HTML to use a `p` tag inside a `span` tag.

---

<div class="post-metadata">

**Author:** ![sashagirl](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sashagirl/32/7478_2.png) [@sashagirl](https://forum.getkirby.com/u/sashagirl)\
**Post date:** [August 21, 2020, 4:46am UTC](https://forum.getkirby.com/t/problem-with-kirbytext-is-duplicating-tags/19132/3 "2020-08-21T04:46:16Z")

</div>

I know what you mean - this is like the preview text and links to a news article page that shows the whole text body and the client wants to include links - This is kirby 3

If this isn’t possible to resolve I will just have to create a new textarea field for the preview text

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [August 21, 2020, 1:09pm UTC](https://forum.getkirby.com/t/problem-with-kirbytext-is-duplicating-tags/19132/4 "2020-08-21T13:09:08Z")

</div>

Maybe it would make more sense to remove tags for the purpose of the preview, using an excerpt that removes all HTML. That way, you don’t end up with invalid code.

> [@sashagirl](#):
>
> \<?= kirbytext($article-\>text()-\>short(550)) ?\>

This line is invalid HTML as well, because the `kirbytext()` method creates a p tag, so you end up with nested p tags.
