On 12 Oct 2008, at 16:32, Andrew Neil wrote:

I just wrote a rake task for showing stats about how many pages are using each Layout. I'm spring cleaning a site which uses unique layouts for quite a few pages. There are a few old drafts which are no longer in use, so I wanted to know which layouts I could discard.

I thought it might be useful for others, so I'll share it here.


Just paste that code into a file called: /lib/tasks/census.rake then run:

        rake (production) census:layouts

Anyone fancy having a go at doing the same for snippets?
(hint: it's non-trivial ;)

I had a go at this. It outputs:

Snippet                      Pages   Layouts   Snippets   Total
-------                      -----   -------   --------   -----
footer                           0        10          0      10
crumbs                           0        10          0      10
right_column                     0        10          0      10
left_column                      0        10          0      10
head                             0         9          0       9
google-analytics                 0         9          0       9
sitemapper                       1         0          1       2
event-listing                    2         0          0       2

Here is the code:


To use this, just paste the whole lot into a file RADIANT_ROOT/lib/ tasks/census.rake

You get the following commands:

        rake census:layouts
        rake census:snippets
        rake usage:layouts
        rake usage:snippets

These tasks could be especially helpful if you are merging two separate Radiant sites into one, using the multi_site extension.

Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to