# I wanna show the list of Pages using the tags in Macro, But only the Published Pages

**URL:** <https://forum.xwiki.org/t/i-wanna-show-the-list-of-pages-using-the-tags-in-macro-but-only-the-published-pages/13121>\
**Category:** Help / Discuss\
**Tags:** xwiki, list, publication-workflow\
**Created:** [September 15, 2023, 8:12am UTC](https://forum.xwiki.org/t/i-wanna-show-the-list-of-pages-using-the-tags-in-macro-but-only-the-published-pages/13121 "2023-09-15T08:12:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agustus](https://forum.xwiki.org/user_avatar/forum.xwiki.org/agustus/32/5714_2.png) [@Agustus](https://forum.xwiki.org/u/Agustus)\
**Post date:** [September 15, 2023, 8:12am UTC](https://forum.xwiki.org/t/i-wanna-show-the-list-of-pages-using-the-tags-in-macro-but-only-the-published-pages/13121/1 "2023-09-15T08:12:12Z")

</div>

I have tried the key “isPublished()” method, but its not working, not showing any page links,  
but if i removed the isPublished condition it shows, Draft Version & Target Version.

Anyone Could help on this issue ?

{{html clean=“false”}}  
#set ($list = $xwiki.tag.getDocumentsWithTag('TagName))  
#set ($tableHtml = "")  
#set ($counter = 1)  
#foreach($reference in $list)  
#set ($document = $xwiki.getDocument($reference))  
#if ($document.isPublished())   
#set ($label = $document.getTitle())  
#set ($tableHtml = $tableHtml + "")  
#set ($counter = $counter + 1)  
#end  
#end  
#set ($tableHtml = $tableHtml + “

 | S.no | Link Description |
| --- | --- |
| $counter | $label |

”) $tableHtml {{/html}}

---

<div class="post-metadata">

**Author:** ![mleduc](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mleduc/32/2328_2.png) [@mleduc](https://forum.xwiki.org/u/mleduc)\
**Post date:** [September 15, 2023, 8:16am UTC](https://forum.xwiki.org/t/i-wanna-show-the-list-of-pages-using-the-tags-in-macro-but-only-the-published-pages/13121/2 "2023-09-15T08:16:24Z")

</div>

Unlisted on September 15, 2023, 8:16am UTC


