Managing the Page Tree in SilverStripe CMS 3.1.x

Managing the Page Tree in SilverStripe CMS 3.1.x


Now, let’s take a look at the site tree of the SilverStripe CMS. These are the pages that I have in my website right now and this About page has child pages, so if I click this little arrow then I can see the children of the
About page, and this is how we refer to them. This is the parent page,
these are the child pages. There may be many kinds of pages available to you in your particular installation of
SilverStripe. The ones that you can see right here… well, there’s the Home Page, and when you hover the names of the pages, you can see what their page type is. These pages are just
regular pages, like a regular interior page, and
then these pages here are error pages and
they have a little slightly different icon than the regular
pages. And these only appear when needed, and they are here in the CMS so that you
can edit the content that the visitor sees if
they happen to see one of these to error pages. So, if I want
to add a new page to the top level of the website,
that is, the same level as the Home Page and these other pages, then I need to click the “Add new” button right here and then I can
choose the sort of page that I want and where it’s going to live. So, it’s going to be a top-level
page and I’m going to choose “User-Defined Form.” This is a module that I have installed
and this installation a SilverStripe.You may or
may not have this module but for the sake of this particular
demonstration, I’m going to choose “User-Defined Form.” So, I’ll just hit “Create” and it adds me a new User-Defined Form
here at the bottom of the list of pages. So,
I’m just going to give it a name really quick. As soon as I hit tab, it generates a name for it in the URL— the URL Segment—and then it also makes
the navigation label match what I put in the page name. So, I’m
just going to save this for now, and you can see my other tutorial about User-Defined Forms to find out
what the rest to these tabs are for. But for now, I’ve just created this page.
So, now I want to move it to a different place in the tree. It’s very easy to do. You can just grab
that page and move it to a different place in the
tree, and sometimes it doesn’t want to move the
first time, so, just try again until it does move. Well, in this case it doesn’t want to
move in this view so I’m going to go over to Pages and see if I can get it to move by grabbing
a little handle. Now, this is a common problem that I often have,
but if I persevere, I will be able to get it to
move. There we go. And I’m not sure what the magic thing is. I just keep
trying until it goes. So, now you’ll notice that this now says “Draft’” after it. That’s
because I only saved. I didn’t save and publish.
Now, if I had published the page in its former location it would
still say “Draft” right here, and that’s because moving a page in the
site tree is a change that is different for published versus draft, so in order
for this move to be saved to the published site, I have to save and
publish this page. Otherwise if I was to view the website
with the published page in one location and the draft page in
another location, it would move if I toggled between the
views of the published site and the draft site. So, I’m just going to save and publish this
and so this is where it’s really going to exist here in my
site tree. And the other thing to note about
SilverStripe is whenever you move pages around in the
site tree, you are actually editing the main
navigation. Which is quite convenient and not all
content management systems do this. So, we’ll go to preview mode and have a
look. So, here is our new contact page and it’s at
the end of the main navigation. This “Your Site Name” takes us back home. If we
click on the About page, then we’ll see its children over here in the sidebar. So, these links here and these links across here are being
generated based on the order of the pages in your
site tree that you’re editing over here. Another kind of page type that’s useful is
a Redirector Page, and I’m going to show you how to insert
a page as a child of an existing page and I’m going to use Redirector Page as
my example. So, if I want to insert a child of this page, I could just, I could click “Add new” and
select the parent as the About page, but it’s easier
to just right-click on the About page and go to “Add new page here” and select the kind of page I want to add. So, a Redirector Paige is a default page type in SilverStript. It doesn’t require
an extra module to get it and it allows you to add a link in the
navigation to a page that’s somewhere else and so this page could be a page on your
own website, or page on another web site. I’m going to
choose a page on my own website and I’m going to actually put a contact link here that redirects to the other contact
page. So, when I hit tab it automatically
generates the URL Segment and updates the navigation label so: “A page on my website” and I’ll select it from the drop-down and save and publish. So, now I have a Redirector Page here
that when people click, they will land on this page. There’s
another kind of page that’s similar, but it’s called a Virtual Page and it
looks like this. Now, if this page that I just created was
a virtual page, it would make a copy of the original
and leave it right here, so if I clicked it, it would look like I was still in the
About section. So, if I click a Virtual Page I stay in the section where am and any
changes that I make to the original are reflected in the copy, but if it’s a
Redirector Page, I actually go to where that page exists and view it in its original location. And that’s the difference between
a Virtual Page and a Redirector Page. Depending upon what modules you have
installed in your version of SilverStripe, you may have a
longer or shorter list of page types to choose from here, and you may need to consult with your
web developers on exactly how to use those page types. So, now we come to another important point. Let’s say I decide that this page is unneeded because, if you are actually
within the About section, you can already see
the contact link in the main navigation. You don’t need a copy of it here in the About sidebar. I’ll show you what I
mean here. I’ll go to the About page and then we’ll
view it in the Preview. So, we can see Contact is here and it’s
over here, so we don’t really need in both places when
we’re in this section because this is always visible. So, we want to get rid of it. So, go back
to edit mode and I’ll click on the Contact Us Redirector Page and I will decide to remove it. Now, a lot of people, when they click this
“More options,” they just see the word “delete” and they don’t think about the fact that it says “Delete
draft” and they just hit “Delete” and it makes the page go away from the
draft site, but it remains published. And while it’s
not in the draft site anymore, it becomes uneditable, but still visible
to the public, so if you want to delete a page, you have to make sure that you unpublish it first before you
delete it. So, I’ve unpublished my page and now it says
“draft,” and I’ll come back down here to “more options” and select “delete draft.” Another thing
that we can do with pages is select a page and change its page type. So, if you want to change the page type of a certain page, you select that page and
then you go to its Settings tab. And you can choose a new page from the drop down here. So, if
I chose Blog Holder—it’ll always bring
up this pop up when you choose a new page type, and it’s just saying that you won’t see
the change and to you save the page the first time.
So, if I save this draft or save and publish, then it will
change this page to a different page type. I’m not
going to do that right now because I don’t really want to change this page to a
Blog Holder, but I can if I want to. Now, this deleted
page will continue to be visible for a little while, but after a bit it will disappear. Now, this is asking me
if I want to save the changes I just made and I’m just going to go click OK to continue because I don’t
care to save that change. So, here’s my deleted page. If I was to
refresh a couple more times, then it would go away, but it’s just here
in case I made a mistake and didn’t mean to delete it. I can always come back here and restore it by clicking the “Restore”
button. If I restore it,t hen it’ll just be in the draft site, just like that. Another feature that can be useful when dealing with pages, is being able to make
them hidden from the menu but still published. So, I’m going to go ahead and just add a
page right here. And different uses for a hidden page might
be if you had an invitation that you were sending by email to a
certain group of people, and you needed them to click through to a page to get more
details, you could set it as a hidden page, and only the
people who received the email would know the link to that page. Another use is if you want to provide your logo and branding materials to certain vendors and people, but you
don’t want the general public to be able to download your logo, you can create the page, and then you can (I’ll just save that really quick—it’s still in the
draft so it won’t be published.) Then you can go to the Settings tab and and uncheck the “Show in menus” button. So, now this page—I’m publishing it but you
won’t see it in the sidebar have the About page. So, let’s go to that About page and view it in the preview. So, we don’t see our Branding Guidelines page here in draft or published site, and we don’t even see our Contact link
in the published site because it’s currently only visible in the draft site. But that BrandingGuidelines page is actually published and visible to people who know the actual link to it. So, here’s the actual path—and we’ll just click that, and
right now, it’s showing us the draft version. If we remove… if we just copy this much
of the URL and put that in our email to people, then they will be
able to see this page even if they are viewing the site and
they don’t see in the navigation, so I’m just going to copy that and I’ll go into a different browser
where I am not logged into the CMS and paste the link in there and see what we
see as if we were a person who received the
email about the branding guidelines. So, I’ll go
ahead and paste it there… paste it there, hit return and here’s our published page but you still don’t see
its link here. So, it’s useful to be able to hide pages
from the menu while they are still being published.

Comments

  1. Post
    Author
  2. Post
    Author

Leave a Reply

Your email address will not be published. Required fields are marked *