3.4. Moving a webpage within an existing site

In order to re-organize a site, to move files within a section etc., the actions are pretty simple since most, if not all, of the work is done within the layout.xml file. The only caveat is to follow the advice given in section Section 3.3 in order to delete or remove content.

If the layout.xml file is viewed as a model of the actual Website files and directories, then it becomes clear how to move a file from one section to another, simply move the file from the source tocentry to the target tocentry. As a simple example. Say we want to move teapot.xml to within the expanded section in the brew directory. The starting layout is shown in Example 5

Example 5. Moving files within a Website

<layout xmlns="http://docbook.org/ns/docbook">
  <toc page="maketea.xml" filename="index.html">              
    <tocentry dir="prepare" page="prep.xml" filename="prepare.html">   
      <tocentry page="ing.xml" filename="ingredients.html"/>
      <tocentry page="teapot.xml" filename="teapot.html"/>
      <tocentry page="prep.k.xml" filename="prep.kettle.html"/>           
    </tocentry>
    <tocentry page="proc.xml" dir="procedure" filename="procedure.html">                     
      <tocentry page="proc.k.xml" filename="proc.kettle.html"/>
      <tocentry dir="brew" page="brew.xml" filename="index.html">  
        <tocentry page="brew.india.xml" filename="india.html"/>
	<tocentry page="brew.china.xml" filename="china.html"/>
	 Move the file here
      </tocentry>
      <tocentry page="pour.xml" filename="serve.html"/>                           
    </tocentry>
  </toc>
</layout>       

Note the docbook namespace again

Since no 'directories' are involved, (i.e. we are not moving a file which has a dir attribute, there is no need to move a block of files, just the one. The modified layout is shown in Example 6

Example 6. Moving files within a Website

<layout xmlns="http://docbook.org/ns/docbook">
  <toc page="maketea.xml" filename="index.html">              
    <tocentry dir="prepare" page="prep.xml" filename="prepare.html">   
      <tocentry page="ing.xml" filename="ingredients.html"/>
      <tocentry page="prep.k.xml" filename="prep.kettle.html"/>           
    </tocentry>
    <tocentry page="proc.xml" dir="procedure" filename="procedure.html">                     
      <tocentry page="proc.k.xml" filename="proc.kettle.html"/>
      <tocentry dir="brew" page="brew.xml" filename="index.html">  
        <tocentry page="brew.india.xml" filename="india.html"/>
	<tocentry page="brew.china.xml" filename="china.html"/>
	<tocentry page="teapot.xml" filename="teapot.html"/>
      </tocentry>
      <tocentry page="pour.xml" filename="serve.html"/>                           
    </tocentry>
  </toc>
</layout>       

That's it. The processing software will re-organise all the links, the table of contents will be updated and all that remains is to build the Website and upload it to your server!

A word of caution. Recall that the dir attribute on a tocentry element implies that a directory is created to hold the files within the tocentry? In the example above, the brew directory holds the two files india.html and china.html.

If you wanted to move the page (produced from) brew.xml, then there are two options. Either move the entire directory (3 files in the example), or re-arrange the content so that (effectively) a new file is created to replace brew.xml and the content from brew.xml is moved to a new file created somewhere else in the structure. Not hard work, just needs a little forethought.

Final word. Depending on how you organise your html files on the server, it may be wise to 'clean out' (remove) most of the files on the server and reload them. This will remove any chance of an old file remaining on the server to clutter up the space and possibly confuse readers who chance across it.

Another final word. If you have many readers; be prepared for complaint from one or two when you move files or reorganize the site. If someone is used to finding india.html in the brew directory and your move means they no longer find it there... you, of course, are to blame! It may be a minor annoyance, but ensure that you have a good reason to reorganize, or prepare for some feedback.