# HowTo: Use a special sitemap, for admins/panel user with many links, e.g. for former WordPress-user

**URL:** <https://forum.getkirby.com/t/howto-use-a-special-sitemap-for-admins-panel-user-with-many-links-e-g-for-former-wordpress-user/1135>\
**Category:** Solutions\
**Tags:** v2\
**Created:** [May 20, 2015, 4:27pm UTC](https://forum.getkirby.com/t/howto-use-a-special-sitemap-for-admins-panel-user-with-many-links-e-g-for-former-wordpress-user/1135 "2015-05-20T16:27:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon77445132](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@anon77445132](https://forum.getkirby.com/u/anon77445132)\
**Post date:** [May 20, 2015, 4:27pm UTC](https://forum.getkirby.com/t/howto-use-a-special-sitemap-for-admins-panel-user-with-many-links-e-g-for-former-wordpress-user/1135/1 "2015-05-20T16:27:09Z")

</div>

### Comments:

- I hope it may be useful for former WordPress-user, who like to view all uploaded medias at one place.
- The source code of the following is based on Kirby version 2.x.

### View as guest

### View as admins/panel user

(!click two times in this picture to grow it here!)

## HowTo

### Remark:

The following is like a [cookbook](http://en.wikipedia.org/wiki/Cookbook#Usage_outside_the_world_of_food)!  
You may want to change some parts of the following, to fit your needs. **Feel free!**  
**Hint:** For the first try, don’t change anything and follow this description “step for step”!

### Step 1:

- Add a new directory in your **/content** directory.
- Name it “ **99-websitemap** ” ( **later** you can change the number “99”, if you need or want, or delete “99-” to have an “invisible” webpage; don’t name it “sitemap”, which you may need for the file “[sitemap.xml](http://forum.getkirby.com/t/sitemaps-easiest-way/361/6)”; **later** change the name in the main menu by using the panel)
- In this directory add an empty file with the name “ **websitemap.txt** ”

### Step 2:

- Add a new file with the name “ **websitemap.php** ” in the directory “ **/site/templates** ”
- This new file should look like:

```php

<?php snippet('header') ?>
<?php $showchanges = 8; // show only changes in the last $showchanges days ?>
<?php $referencetime = date('U') - $showchanges*24*60*60; ?>
  <main class="main" role="main">
    <div class="text">
      <h1><?php echo html($page->title()) ?><?php if($user = $site->user()): // user is logged in ?><?php if($user->hasPanelAccess()): ?><a href="<?php echo $site->url() ?>/panel/#/pages/show/<?php echo $page->uri() ?>/p:1" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="Edit site data (in new window / tab)" class="admineditlink"><sup class="fa fa-cog admincolor1"></sup></a><?php endif ?><?php endif ?></h1>
      <?php echo kirbytext($page->text()) ?>

<?php if($user = $site->user()): // user is logged in ?>
      <p class="internally1"><strong>Attention!</strong><br>Because you are logged in, you will see <strong>additional</strong> entries, informations (e.g. for all pages with changes in the last <?php echo $showchanges ?> days the last modification date is indicated!) and links, which "normal" site visitors <strong>cannot see</strong>!<br>If you want, you can <strong>log out</strong> and then go to this sitemap <strong>as a guest</strong> again!<br><em>The Webmaster</em></p>
<?php endif ?>
      <div class="websitemenu">
<?php snippet('treemenu_extended', array('showchanges' => $showchanges)); ?>

<?php if($user = $site->user()): // user is logged in ?>
<?php if($site->hasFiles()): ?>
        <span class="internally1">This website has <?php echo $site->hasFiles(); ?> global site <?php ecco(($site->hasFiles() == 1), 'file', 'files') ?>:</span><?php if($user->hasPanelAccess()): ?><a href="<?php echo $site->url() ?>/panel/#/files/index/" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="View all global site files (in a new window / tab)" class="admineditlink2"><sup class="fa fa-cog admincolor2"></sup></a><?php endif ?>

        <ul class="depth-1 internally3 sitefiles">
<?php foreach($site->files() as $file): ?>
          <li><a href="<?php echo $file->url() ?>" target="<?php echo c::get('HeinerEF.ShowTarget', '_blank'); ?>">
              <?php echo $file->filename() ?></a>
                <?php if($user->hasPanelAccess()): ?><a href="<?php echo $site->url() ?>/panel/#/files/show/<?php echo $site->uri() ?>/<?php echo $file->filename() ?>" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="View this file (in a new window / tab)" class="admineditlink3"><sup class="fa fa-cog admincolor3"></sup></a><?php endif ?>
<?php if($file->type() == 'image'): ?>
:<?php echo thumb($file, array('width' => 200, 'height' => 150)); ?>
<?php else: ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php endif ?>
<?php if($file->modified() >= $referencetime): ?><span class="mini">(<?php echo $file->niceSize() ?>, last updated: <?php echo $file->modified('d.m.Y H:i') ?>)</span><?php endif ?>

          </li>
<?php endforeach ?>
        </ul>
<?php endif ?>
<?php endif ?>
      </div>
    </div>
  </main>
<?php snippet('footer') ?>

```

### Step 3:

- Add a new file with the name “ **treemenu\_extended.php** ” in the directory “ **/site/snippets** ”
- This new file should look like:

```php

<?php $templateignore = array('blog', 'events'); // children of $templateignore are ignored in the _public_ sitemap ?>
<?php if(!isset($subpages)): $subpages = $site->pages(); endif; ?>
<?php $referencetime = date('U') - $showchanges*24*60*60; ?>
<?php if(!isset($level)): $level=1; ?>
      <ul class="depth-1">
<?php else: ?>
<?php $level+1; ?>
      <ul class="depth-<?php echo $level; ?>">
<?php endif ?>
<?php if($user = $site->user()): // user is logged in ?>
<?php $thesubpages = $subpages; ?>
<?php else: ?>
<?php $thesubpages = $subpages->visible(); ?>
<?php endif ?>
<?php foreach($thesubpages as $p): ?>
        <li class="depth-<?php echo $p->depth() ?>">
          <a<?php echo ($p->isActive()) ? ' class="active"' : '' ?> href="<?php echo $p->url() ?>" title="<?php echo $p->title()->html() ?>"><?php echo $p->title()->html() ?></a>
<?php if(($user = $site->user())): // user is logged in ?><?php if($user->hasPanelAccess()): ?><a href="<?php echo $site->url() ?>/panel/#/pages/show/<?php echo $p->uri() ?>/p:1" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="Edit site data (in a new window / tab)" class="admineditlink1"><sup class="fa fa-cog admincolor1"></sup></a><?php endif ?>
<?php if($p->modified() >= $referencetime): ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="mini">(last updated: <?php echo $p->modified('d.m.Y H:i') ?>)</span><?php endif ?>

<?php if($p->hasFiles()): ?>
          <br><span class="internally2">has <?php echo $p->hasFiles(); ?> assigned <?php ecco(($p->hasFiles() == 1), 'file', 'files') ?>:</span><?php if($user->hasPanelAccess()): ?><a href="<?php echo $site->url() ?>/panel/#/files/index/<?php echo $p->uri() ?>" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="View all files of this webpage (in a new window / tab)" class="admineditlink2"><sup class="fa fa-cog admincolor2"></sup></a><?php endif ?>

          <ul class="internally3">
<?php foreach($p->files() as $file): ?>
            <li>
              <a href="<?php echo $file->url() ?>" target="<?php echo c::get('HeinerEF.ShowTarget', '_blank'); ?>"><?php echo $file->filename() ?></a>
                <?php if($user->hasPanelAccess()): ?><a href="<?php echo $site->url() ?>/panel/#/files/show/<?php echo $p->uri() ?>/<?php echo $file->filename() ?>" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="View this file (in a new window / tab)" class="admineditlink3"><sup class="fa fa-cog admincolor3"></sup></a><?php endif ?>
<?php if($file->type() == 'image'): ?>
:<?php echo thumb($file, array('width' => 200, 'height' => 150)); ?>
<?php else: ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php endif ?>
<?php if($file->modified() >= $referencetime): ?><span class="mini">(<?php echo $file->niceSize() ?>, last updated: <?php echo $file->modified('d.m.Y H:i') ?>)</span><?php endif ?>

            </li>
<?php endforeach ?>
          </ul>
<?php endif ?>
<?php endif ?>
<?php if($p->hasChildren()): ?>
<?php if(($user = $site->user()) || (!(in_array($p->template(), $templateignore)))) : ?>
<?php if((in_array($p->template(), $templateignore))): ?>
   <span class="internally">
<?php endif ?>
  <?php snippet('treemenu_extended', array('subpages' => $p->children(), 'level' => $level+1, 'showchanges' => $showchanges)) ?>
<?php if((in_array($p->template(), $templateignore))): ?>
   </span>
<?php endif ?>
<?php endif ?>
<?php endif ?>
        </li>
<?php endforeach ?>
      </ul>
<?php $level-1; ?>

```

### Step 4:

- Within your CSS file add these lines at the end of the file:

```css

/* ==================================================== */
@font-face {
  font-family: 'FontAwesome';
  font-weight: normal;
  font-style: normal;
  src: url(../../panel/assets/fonts/fontawesome-webfont.woff) format('woff');
}
.fa {
  display: inline-block;
  font-family: FontAwesome;
  font-feature-settings: normal;
  font-kerning: auto;
  font-language-override: normal;
  font-size: inherit;
  font-size-adjust: none;
  font-stretch: normal;
  font-style: normal;
  font-synthesis: weight style;
  font-variant: normal;
  font-weight: normal;
  line-height: 1;
  text-rendering: auto;
}
.fa-cog:before {
  content: "\f013";
}
/* The following colors are deliberately garish chosen to show the different levels significantly. Please adjust! */
.internally1 strong {
  color: #F0F;
  font-weight: 600;
}
.internally2,
.internally3 {
  font-size: 80%;
}
.admincolor1 {
  color: #00F;
}
.admincolor2 {
  color: #0F0;
}
.admincolor3 {
  color: #F00;
}

```

### Step 5:

- Log in at the panel and keep logged in
- Go to your webpage “ **/websitemap** ” in another browser window (being logged in).
- Enjoy!
- Click at a **gear wheel**! Then enjoy too!

### Next Steps:

- You may want to look at this webpage “ **/websitemap** ” as a **guest** (not logged in)!
- Modify the file “ **treemenu\_extended.php** ” in the directory “ **/site/snippets** ” to fit your needs.
- Modify the file “ **websitemap.php** ” in the directory “ **/site/templates** ” to fit your needs.
- Modify and extend the CSS file and extend the file “ **config.php** ” (in this post I show only the main elements, you need to test this idea).

_[last edited: 2015-05-27 18:13 / German time]_

Good luck!

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [May 21, 2015, 11:10am UTC](https://forum.getkirby.com/t/howto-use-a-special-sitemap-for-admins-panel-user-with-many-links-e-g-for-former-wordpress-user/1135/2 "2015-05-21T11:10:49Z")

</div>

I have not tried it out yet but the screenshots looks nice.

In my case I would probably make it into a gallery with thumbnails.

Thanks!

---

<div class="post-metadata">

**Author:** ![anon77445132](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@anon77445132](https://forum.getkirby.com/u/anon77445132)\
**Post date:** [August 8, 2015, 8:24am UTC](https://forum.getkirby.com/t/howto-use-a-special-sitemap-for-admins-panel-user-with-many-links-e-g-for-former-wordpress-user/1135/3 "2015-08-08T08:24:06Z")

</div>

Some time ago, I have build another HowTo, which you can use here too:  
[HowTo: Working with contextual links to the panel](http://forum.getkirby.com/t/howto-working-with-contextual-links-to-the-panel/1566)

Good luck!

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:16pm UTC](https://forum.getkirby.com/t/howto-use-a-special-sitemap-for-admins-panel-user-with-many-links-e-g-for-former-wordpress-user/1135/4 "2025-02-06T17:16:55Z")

</div>

Archived on February 6, 2025, 5:16pm UTC


