# Showing only excerpts (selectively) for not logged in users

**URL:** <https://meta.discourse.org/t/showing-only-excerpts-selectively-for-not-logged-in-users/56874>\
**Category:** Feature\
**Created:** [3 Febrero, 2017 18:43 UTC](https://meta.discourse.org/t/showing-only-excerpts-selectively-for-not-logged-in-users/56874 "2017-02-03T18:43:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [3 Febrero, 2017 20:23 UTC](https://meta.discourse.org/t/showing-only-excerpts-selectively-for-not-logged-in-users/56874/2 "2017-02-03T20:23:33Z")

</div>

The ‘excerpt’ class is whitelisted for the span tag, so you could try wrapping the excerpt in `<span class="excerpt"></span>` tags and then add a site customization to display only the excerpt for non-logged in users.

This works, but I’m not sure if it will have any unintended side effects:

```js
<script type="text/discourse-plugin" version="0.5">
      
    const anonExcerpt = ($elem) => {
        const currentUser = api.getCurrentUser();
        const excerpt = $elem.find('.excerpt').html();
        
        if(!currentUser) {
            $elem.html(excerpt + ' <strong style="white-space:nowrap;">( ...login to continue)</strong>');
        }
    }
    
    api.decorateCooked(anonExcerpt);
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/showing-only-excerpts-selectively-for-not-logged-in-users/56874)._
