PHPackages                             silverstripe/sitetreeimporter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. silverstripe/sitetreeimporter

Abandoned → [silverstripe/sitetreeimporter](/?search=silverstripe%2Fsitetreeimporter)Silverstripe-module

silverstripe/sitetreeimporter
=============================

Imports indented plaintext files into a SilverStripe sitetree

1.0.0(13y ago)95.1k10[2 issues](https://github.com/silverstripe-archive/silverstripe-sitetreeimporter/issues)[1 PRs](https://github.com/silverstripe-archive/silverstripe-sitetreeimporter/pulls)PHP

Since Mar 29Pushed 5y ago14 watchersCompare

[ Source](https://github.com/silverstripe-archive/silverstripe-sitetreeimporter)[ Packagist](https://packagist.org/packages/silverstripe/sitetreeimporter)[ RSS](/packages/silverstripe-sitetreeimporter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Site Tree Importer Module
=========================

[](#site-tree-importer-module)

[![Build Status](https://camo.githubusercontent.com/a6c367590da778fe60a886273d4e87db5f2b6acbf1f73d13bb9485299776777a/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f73696c7665727374726970652d6c6162732f73696c7665727374726970652d7369746574726565696d706f727465722e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/silverstripe-labs/silverstripe-sitetreeimporter)

Requirements
------------

[](#requirements)

- SilverStripe 4 or later

Installation
------------

[](#installation)

No installation required.

Usage
-----

[](#usage)

Make a tabbed-out file as directed in the form that appears below. Make sure that you use tabs, not spaces. Visit `http://localhost/your-site-name/SiteTreeImporter?flush=1`. Select your tabbed-out file in the file field, and tick the option boxes as appropriate:

*Clear out all existing content?* - This will delete everything from your site before running the importer. Use with caution! If you don't tick this, then the pages will be added to the existing site.

*Publish everything after the import?* - This will publish each of the pages that the importer creates. If you don't tick this, then the pages will be left as draft-only.

Format
------

[](#format)

The site tree import module lets you take a tabbed out file of the following format, and load it into your CMS as a site tree.

```
Home
About
	Staff
		Sam
		Sig
Products
	Laptops
		Macbook
		Macbook Pro
	Phones
		iPhone
```

You can optionally include JSON encoded metadata as the last part of a line, which will automatically save to properties on the `Page` object. This can be useful to determine URL paths or set custom titles.

```
Home
	About {"URLSegment": "about-us", "MetaDescription": "About our company"}
	Contact {"URLSegment": "contact-us"}
```

Howto
-----

[](#howto)

### Redirect URLs

[](#redirect-urls)

Often an existing tree will need to be imported with URLs which map to different URLs on the new site. While you could assign those manually to a `.htaccess` based redirect, we found it useful to store the old URL straight in the `Page` object, and use SilverStripe's routing to handle the redirect.

In this example, we'll use the ["redirected urls" module](http://addons.silverstripe.org/add-ons/silverstripe/redirectedurls), which routes based on a new data type called `RedirectedURL`. In order to create it, we add a custom setter to the `Page` class, which gets called automatically if a key named `LegacyURL` is found in the imported JSON data.

```
class Page extends SiteTree {
	public function setLegacyURL($url) {
		$url = Director::makeRelative($url);
		$urlBase = parse_url($url, PHP_URL_PATH);
		$urlQuerystring = parse_url($url, PHP_URL_QUERY);

		$urlObj = RedirectedURL::get()->filter(array(
			'FromBase' => $urlBase,
			'FromQuerystring' => $urlQuerystring
		))->First();
		if(!$urlObj) {
			 $urlObj = new RedirectedURL();
		}
		$urlObj->FromBase = $urlBase;
		$urlObj->FromQuerystring = $urlQuerystring;

		if(!$this->URLSegment) {
			$this->URLSegment = $this->generateURLSegment($this->Title);
		}
		$urlObj->To = $this->RelativeLink();

		$urlObj->write();
	}
}
```

Now you can import a tree based on the following data:

```
Home
	About {"LegacyURL": "/old-about-location"}
	Contact {"LegacyURL": "/old-contact-location"}
```

Related
-------

[](#related)

See the [static site connector module](http://addons.silverstripe.org/add-ons/silverstripe/staticsiteconnector) for a more sophisticated importer based on crawling existing HTML pages, and extracting content via XPATH.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4790d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0cba8b534e20e6ab4fff555a97b237a18436ebca1446fc0b29c8a8b504038b9?d=identicon)[GuySartorelli](/maintainers/GuySartorelli)

![](https://avatars.githubusercontent.com/u/111025?v=4)[Ingo Schommer](/maintainers/chillu)[@chillu](https://github.com/chillu)

![](https://www.gravatar.com/avatar/be6648e60fbab6f70bfc34dd8c14259562d28a47510a934ea9c01fe98633f3c2?d=identicon)[sminnee](/maintainers/sminnee)

---

Top Contributors

[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (22 commits)")[![adiwidjaja](https://avatars.githubusercontent.com/u/280394?v=4)](https://github.com/adiwidjaja "adiwidjaja (3 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (3 commits)")[![jellygnite](https://avatars.githubusercontent.com/u/458854?v=4)](https://github.com/jellygnite "jellygnite (2 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (2 commits)")[![mateusz](https://avatars.githubusercontent.com/u/118653?v=4)](https://github.com/mateusz "mateusz (1 commits)")

---

Tags

silverstripeimport

### Embed Badge

![Health badge](/badges/silverstripe-sitetreeimporter/health.svg)

```
[![Health](https://phpackages.com/badges/silverstripe-sitetreeimporter/health.svg)](https://phpackages.com/packages/silverstripe-sitetreeimporter)
```

###  Alternatives

[silverstripe/cms

The SilverStripe Content Management System

5163.4M1.3k](/packages/silverstripe-cms)[silverstripe/admin

SilverStripe admin interface

262.6M325](/packages/silverstripe-admin)[silverstripe/silverstripe-omnipay

SilverStripe Omnipay Payment Module

38106.0k15](/packages/silverstripe-silverstripe-omnipay)[silverleague/ideannotator

Generate PHP DocBlock annotations for DataObject and DataExtension databasefields and relation methods

4768.0k43](/packages/silverleague-ideannotator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
