<?xml version="1.0"?>
<!DOCTYPE webpage
  PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
    "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd">

<webpage id="developers-htdocs">
<config param="desc" value="Editing htdocs"/>
<config param="cvstag" value="$NetBSD: htdocs.xml,v 1.52 2012/04/20 12:50:02 darcy Exp $"/>
<config param="rcsdate" value="$Date: 2012/04/20 12:50:02 $"/>
<head>
<title>Editing htdocs</title>
</head>

<sect1 id="editing-htdocs" role="toc">

<sect2 id="general">
<title>General notes on htdocs</title>

<sect3 id="who-can-edit">
<title>Who can edit htdocs</title>
<para>
    Anyone with write access to the NetBSD CVS tree can checkout
    htdocs and make changes, and in fact is encouraged to do so.
    In particular as developers add features and drivers they should
    update the appropriate hardware or port homepage. Use your
    NetBSD.org login against cvs.NetBSD.org and checkout 'htdocs'.
</para>
<para>
    Users without CVS commit access are encouraged to check out htdocs
    via anoncvs, and mail patches to www@NetBSD.org; see
    <ulink url="#dotlist-files">below</ulink>.
</para>
</sect3>

<sect3 id="what-is-required">
<title>What is required to edit htdocs</title>
<para>
  <itemizedlist>
    <listitem>Read <ulink url="cvs-repos/cvs_intro.html">the CVS
      introduction</ulink>.
    </listitem>
    <listitem>Install <filename role="pkg">meta-pkgs/netbsd-www</filename>,
        which provides the tools
	required to build the web site.  Please make sure that you have at
	least <filename role="pkg">textproc/docbook-xsl</filename>
	&gt;= 1.68.1 and
	<filename role="pkg">textproc/docbook-website</filename>
	&gt;= 2.6.0nb1 (automatically
	required by <filename role="pkg">meta-pkgs/netbsd-www</filename>
	1.4, but earlier versions accepted earlier revisions of
	required tools, which may not be appropriate).  Please note that
	any special LOCALBASE or PKG_SYSCONFBASE settings in
	<filename>/etc/mk.conf</filename> should <emphasis>not</emphasis>
	be protected by BSD_PKG_MK as their values are used by the htdocs
	makefiles.
    </listitem>
    <listitem>Also install
	<filename role="pkg">meta-pkgs/netbsd-doc-print</filename>
	to regenerate <ulink url="../docs/guide/en/">The NetBSD guide</ulink>
	and some other pages which depend on the guide.
    </listitem>
    <listitem>Set your CVSROOT as indicated and run
      <para><programlisting>cvs checkout htdocs</programlisting></para>
    </listitem>
    <listitem>Edit your preferred file, type
      <code><emphasis role="bold">make</emphasis></code>
      to rebuild the output files (if necessary).
    </listitem>
    <listitem>Check the results using
      <code><emphasis role="bold">cvs diff</emphasis></code>, and
      <code><emphasis role="bold">cvs commit</emphasis></code> if everything
      is good.
    </listitem>
  </itemizedlist>
</para>
</sect3>

<sect3 id="validate-html">
<title>Validate your HTML</title>
<para>
    After making any changes you should run your html through an HTML
    verifier such as <filename role="pkg">www/weblint</filename>,
    or better still <ulink
    url="http://validator.w3.org/">http://validator.w3.org/</ulink>.
    The URL for a link to an index.html file should not include the
    trailing index.html.
    If you use weblint you may want to add the following to your
    <code>~/.weblintrc</code>.
</para>
<para>
    <programlisting>extension Netscape</programlisting>
</para>
</sect3>

<sect3 id="NetBSD-org">
<title>NetBSD.org naming scheme</title>
<para>
    Make sure you use NetBSD.org and not any other scheme (&#78;etbsd.org,
    &#110;etbsd.org, ...) in links, mailto's, or other pointers.
</para>
</sect3>

<sect3 id="dotlist-files">
<title>What are .list files?</title>
<para>
    <emphasis role="bold">The <code>.list</code> files are
    obsolete!</emphasis><html:br/>
    You should convert any existing <code>.list</code> files to XML.
    Please see <ulink url="#convert-to-xml">this section</ulink> for details.
</para>
</sect3>

<sect3 id="convert-to-xml">
<title>Converting to XML</title>
<para>
    In order to facilitate global changes, we are currently converting the
    NetBSD website to XML (docbook-website).  As of 2004-11-15, any non-XML
    file that needs to be edited shall be converted to XML at the same time.
    You may find the script <code>htdocs/scripts/list2xml</code> helpful to
    initiate the conversion of the old <code>.list</code> as well as plain
    <code>.html</code> files.  Please note, however, that this script only
    does a few simple replacements of tags, and you will need to do a lot by
    hand after running it.  In particular, you need to make sure that all
    tags are closed in the proper order.
</para>
<para>
    When creating or converting <code>.xml</code> files, please make sure to
    add a <quote>id</quote> attribute to each <code>&lt;sect[1-4]&gt;</code>
    as well as each <code>&lt;table&gt;</code> tag:  this will prevent
    <command>xsltproc</command> to generate an ID
    itself, which would require an update of the resulting <code>.html</code>
    file after each regeneration. Also remember to replace each
    <quote>&amp;</quote> with <quote>&amp;amp;</quote> and
    <filename>/sys</filename> with <filename>/usr/src/sys</filename>
    where applicable.
</para>
<para>
    If you are unsure how to convert a given HTML tag to the XML equivalent,
    you may find some useful examples installed as part of the
    <filename role="pkg">textproc/docbook-website</filename> on your system.
    And of course you can
    feel free to ask on the www@ list for help.
</para>
<para>
    If you want an autogenerated TOC, you will need to include the following
    code:
    <programlisting>&lt;sect1 role="toc"&gt;</programlisting>
    This will generate a TOC listing all <code>&lt;sect2&gt;</code>s with a
    bulleted list of its <code>&lt;sect3&gt;</code>s.
</para>
<para>
    After converting a file to XML, remember to add it to the
    <code>htdocs/layout.xml</code> file and regenerate the website.  See
    <ulink url="#dotxml-files">below</ulink> for details.
</para>
<!--
XXX: put back when we do switch
<para>
    Finally, remember that as of 2005-02-05 file generated
    <emphasis>from</emphasis> XML need no longer be added to CVS, as these
    files are generated <ulink url="#webserver">on nbwww</ulink>.  In fact,
    these <quote>object files</quote> will likely be removed from CVS control
    altogether.
</para>
-->
</sect3>

<sect3 id="dotxml-files">
<title>Processing .xml (docbook-website) files</title>
<para>
    In order to build .html files from .xml files, you will need at
    least <filename role="pkg">textproc/libxslt</filename> and
    <filename role="pkg">textproc/docbook-website</filename>
    installed. These are installed as part of <filename
    role="pkg">meta-pkgs/netbsd-www</filename>.
    Please make sure that you have <filename
    role="pkg">meta-pkgs/netbsd-www</filename> version
    1.4.
</para>
<para>
    To regenerate, just run
    <code><emphasis role="bold">make</emphasis></code> in the target directory.
</para>
<para>
    If you added a new file to <filename>layout.xml</filename>,
    then you do need to run <code>make</code> in the htdocs top level.
</para>
</sect3>

<sect3 id="moving-files">
<title>Renaming or moving files</title>
<para>
In order to move or rename files within htdocs, the following procedure is
recommended:

<itemizedlist>
 <listitem>copy the file from the original location to new location</listitem>
  <listitem>cvs add the new file and cvs rm the old file</listitem>
  <listitem>add a note to <filename>htdocs/errors/index.xml</filename>, linking
      to the new location
  </listitem>
  <listitem>cvs commit the new file and the old file at the same
      time, so we have some cvs reference of when and why
      things moved.
  </listitem>
</itemizedlist>
</para>
</sect3>

<sect3 id="flaglinks">
<title>What is the reasoning behind the flag links with empty.gif?</title>
<para>
    Each NetBSD 'flag' links at the base of each page has:
    <itemizedlist>
    <listitem>href containing netbsd-banner with no alt tag</listitem>
    <listitem>href containing empty gif with "NetBSD" alt tag and the
        words "Home Page"</listitem>
    </itemizedlist>
    This has the effect of:
    <itemizedlist>
    <listitem>Making the "NetBSD Home Page" link a single link in lynx,
	i.e. not a NetBSD link and a Home Page link.</listitem>
    <listitem>In netscape, causing the additional text to be centered and
        aligned "better" w.r.t the graphic.  Without it, at least
        in netscape, they show up at the bottom not centered
        vertically, and abut the graphic (or, if you include spaces,
        include nasty underlined blanks which looks broken).</listitem>
    </itemizedlist>
    It's a grotty hack, but it makes things look right.
</para>
</sect3>

  <sect3 id="templates">
    <title>XML template files</title>

    <para>
      There are a few template files in <filename>htutils/templates</filename>
      to get you started with XML.  Please compare to existing pages in use
      when you add new content.
    </para>
  </sect3>

<sect3 id="webserver">
<title>How do the pages get to the web server, and when?</title>
<para>
    The NetBSD webpages are stored in CVS in the "htdocs" repository.
    For security reasons, the htdocs repository is copied (via rsync)
    to www.NetBSD.org each hour, and then a local checkout is done from
    that copy of the repository.  <!-- As of 2005-02-05, nbwww builds the
    website from the CVS checkout in a staging directory, then copies any
    modified files into the live website under
    <quote><code>/NetBSD-www</code></quote>. -->The script performing this
    functionality is <filename>htutils/scripts/update.http</filename> and it
    is run about 40 minutes after the full hour (*:40). If you
    make a commit to htdocs, it will take up to an hour before the
    changes show up.
</para>
<para>
    Note that there are several files like the Gnats database
    (<ulink url="http://www.NetBSD.org/Gnats/"/>), the pkgsrc and source changes
    in changes/changes*.html and changes/pkg-changes*.html, the RSS
    files in changes/rss-*.xml etc. that are not part of htdocs but
    that get generated by various scripts out of cron jobs directly on
    the web server. Check out "htutils/changes/*" to get access to the
    scripts.
</para>
</sect3>

</sect2>

<sect2 id="structure">
<title>How is the whole web site structured?</title>

<sect3 id="structure-overview">
<title>Overview</title>

	<para></para>

</sect3>

<sect3 id="structure-directories">
<title>What are the individual directories for?</title>

	<variablelist>

	<varlistentry><term><filename>share/mk</filename></term>
	<listitem><para>Contains the &man.make.1; infrastructure to
	automatize the generation of the web pages from the source
	files.</para></listitem></varlistentry>

	<varlistentry><term><filename>share/xml</filename></term>
	<listitem><para>[TODO]</para></listitem></varlistentry>

	<varlistentry><term><filename>share/xsl</filename></term>
	<listitem><para>[TODO]</para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	<varlistentry><term><filename></filename></term>
	<listitem><para></para></listitem></varlistentry>

	</variablelist>

</sect3>

<sect3 id="structure-files">
<title>What are the individual files for?</title>

	<variablelist>

	<varlistentry><term><filename>Makefile</filename></term>
	<listitem><para>Contains a description of the directory's
	contents. Usually it suffers to define the variables
	<varname>SUBDIR</varname> and <varname>XMLDOCS</varname>, and
	then <command>.include</command> the file
	<filename>htdocs/share/mk/web.site.mk</filename> using the
	appropriate relative path. The files in the
	<filename>share/mk</filename> contain large comments at the top
	that describe what you can do in the
	<filename>Makefile</filename>.</para></listitem></varlistentry>

	<varlistentry><term><filename>*.xml</filename></term>
	<listitem><para>XML files contain the source code for a single
	HTML page, in the <quote>DocBook Website</quote>
	format.</para></listitem></varlistentry>

	<varlistentry><term><filename>layout.xml</filename></term>
	<listitem><para>[TODO]</para></listitem></varlistentry>

	<varlistentry><term><filename>autolayout.xml</filename></term>
	<listitem><para>[TODO]</para></listitem></varlistentry>

	</variablelist>

</sect3>

</sect2>

<sect2 id="specific">
<title>Adding to specific areas</title>

<sect3 id="adding-gallery-entries">
<title>Adding to the <quote>Sites running NetBSD</quote> gallery</title>
<para>
If you have a <code>NETBSD GALLERY ADDITION</code> email from the <ulink
url="../gallery/addsite.html">htdocs/gallery/addsite.html</ulink> page:
<orderedlist>
  <listitem>Verify that the remote site has a link back to www.NetBSD.org.
    If they do not link back, contact them to ask for a link back and add
    the information once the link is provided.</listitem>
  <listitem>Ensure you have perl installed.</listitem>
  <listitem>Save the message in your copy/paste buffer.</listitem>
  <listitem><code>cd htdocs/gallery</code>.</listitem>
  <listitem><code>./addsite.pl</code>, paste the buffer, add a ^D, and answer
      <code>y</code> if it parsed OK.</listitem>
  <listitem><code>cvs commit</code>.</listitem>
</orderedlist>
Alternatively you can manually edit <code>htdocs/gallery/sites.data</code>, and
run <code>make</code>.
</para>
</sect3>

<sect3 id="adding-gallery-screenshots">
<title>Adding to the <quote>NetBSD in action</quote> gallery</title>
<para>
If possible, a screenshot should contain some easily recognizable visual
indication that it was made on a &os; system. A common way to do this is
by showing an X terminal that displays the output of <code>uname -a</code>.
</para>
</sect3>

<sect3 id="adding-news-items">
<title>Adding News Items</title>
<para>
Most news items go into <ulink
url="../changes/">htdocs/changes/index.xml</ulink> (see note on
<ulink url="#dotxml-files">.xml files</ulink>).  Changes affecting a
specific port should also be linked to from their htdocs/ports/*/ news section.
</para>
<para>
Important code news items should also be noted in the text
<currentsrc>src/doc/CHANGES</currentsrc>
file.
</para>
<para>Quick ``howto'' for the impatient (but please do read on for details):
<itemizedlist>
  <listitem>cd htdocs/changes</listitem>
  <listitem>make update</listitem>
  <listitem>${EDITOR} index.xml</listitem>
  <listitem>make</listitem>
  <listitem>make MSG="I added important NEWS!" commit</listitem>
</itemizedlist>
</para>

<sect4 id="before-anything">
<title>Before you do anything with htdocs:</title>
<orderedlist>
  <listitem>Ensure you have <filename
    role="pkg">meta-pkgs/netbsd-www</filename> installed.
    Also, see <ulink url="#what-is-required">above</ulink>.</listitem>
  <listitem>Check out <code>htdocs</code> from the CVS repository.</listitem>
  <listitem>If you already have a copy of htdocs in your tree, make sure you
    update it regularly.  In particular, when adding news items, make sure that
    gallery/events.* is up to date as well, as the events are pulled in from
    there!  This is best done by running
    <programlisting>
  $ cd htdocs
  $ make update</programlisting>
  </listitem>
</orderedlist>
</sect4>

<sect4 id="change-entry">
<title>To add a change entry:</title>
<orderedlist>
  <listitem>Edit htdocs/changes/index.xml.</listitem>
  <listitem>In the right section, add the entry of the form
    <programlisting>
  &lt;sect3 id="link-name&gt;
  &lt;title&gt;XX Mon XXX - FREEFORM TITLE&lt;/title&gt;
  &lt;para&gt;
    Entry text goes here.  Manual pages can be referred to as <quote>&amp;man.command.X;</quote>,
    email addresses as &lt;email&gt;full@address&lt;/email&gt;.
  &lt;para&gt;
  &lt;/sect3&gt;</programlisting>
  </listitem>
  <listitem>Run <code>make</code>.</listitem>
</orderedlist>
</sect4>

<sect4 id="adding-links">
<title>Adding links from the main pages:</title>
<para>
By running <code>make</code> from within htdocs/changes, you will automatically
update <ulink url="../">htdocs/index.html</ulink>.  No further action on your part
is required.
</para>
<para>
Alternatively, you can run <code>make index.html</code> from the htdocs toplevel
directory.
</para>
</sect4>

<sect4 id="link-specific">
<title>If you want to add a link from a port specific page:</title>
<orderedlist>
  <listitem>Edit htdocs/ports/<emphasis>arch</emphasis>/index.html, and search
    for the '&lt;!-- news --&gt;' block.</listitem>
  <listitem>Add a new entry to the subsequent list in the form:
    <para>
    <programlisting>&lt;dt&gt;&lt;b&gt;<emphasis>date</emphasis>:&lt;/b&gt; <emphasis>title</emphasis>
    &lt;dd&gt;<emphasis>body of item</emphasis>
    &lt;p&gt;</programlisting>
    </para>
    where
    <itemizedlist>
    <listitem><emphasis>date</emphasis> - Normally as YEAR.MONTH.DATE</listitem>
    <listitem><emphasis>title</emphasis> - Freeform (short) text title</listitem>
    <listitem><emphasis>body of item</emphasis> - Freeform text for the entry.
        Can span multiple lines and may use HTML tags and links.</listitem>
    </itemizedlist>
</listitem>
</orderedlist>
</sect4>

<sect4 id="finally">
<title>Finally:</title>
<orderedlist>
  <listitem>You may want to <ulink url="#validate-html">validate the
    HTML</ulink> in your modified files.</listitem>
  <listitem>Check in the files.  The command <code>make commit</code>, when
    issued from the htdocs toplevel directory, will commit the main
    index-page with a default message of "NEWS; regen".  If you would
    like to add a more specific message, use <code>MSG="Added News regarding
     FooBar" make commit</code>.</listitem>
  <listitem>If the news is noteworthy it is a good idea to submit it to some
    news sites, like
    <ulink url="http://daily.daemonnews.org/add_story.php3">Daily Daemonnews</ulink>,
    <ulink url="http://www.osnews.com/submit.php">OSNews</ulink>,
    <ulink url="http://slashdot.org/submit.pl">Slashdot</ulink>,
    <ulink url="http://www.newsforge.com/submit.pl">Newsforge</ulink> and
    <ulink url="http://www.bsdforums.org/submitnews.php">BSDForums</ulink>.
   </listitem>
</orderedlist>
</sect4>

</sect3>

<sect3 id="adding-events">
<title>Adding Events</title>
<para>
The main index page also contains links to "Upcoming Events".  These links are
updated much like the <ulink url="#adding-news-items">News entries</ulink>:
</para>
<para>
  <programlisting>
cd .../htdocs/gallery
$EDITOR events.xml
make events.html</programlisting>
</para>

<para>
  <programlisting>
cd .../htdocs
make index.html
MSG="Added Event Foo" make commit</programlisting>
</para>
</sect3>

<sect3 id="adding-mailinglists">
<title>Adding to/editing the MailingLists page </title>
<para>
If a mailing list is missing from the
<ulink url="../mailinglists/">MailingLists</ulink> page:
<orderedlist>
  <listitem>Edit the htdocs/mailinglists/index.xml and htdocs/mailinglists/list2group.xsl files.</listitem>
  <listitem>Run the makefile in htdocs/mailinglists, it will generate the
    index.html.</listitem>
  <listitem>Confirm the generated html is good.</listitem>
  <listitem>Commit the index.xml and list2group.xsl files.</listitem>
  <listitem>Regenerate the index.html file to include the proper
    "generated from" statement.</listitem>
  <listitem>Commit the generated index.html file.</listitem>
</orderedlist>
</para>
</sect3>

<sect3 id="consultants">
<title>Consultants for hire</title>
<para>
Before adding an entry to the ``Consultants for hire'' page (<ulink
url="../gallery/consultants.html">gallery/consultants.html</ulink>), please ask
that the person in question provides a link back to our homepage and/or
mentions NetBSD on their website.  Needless to say that you should make sure
that the URL given is active and accessible.
</para>

</sect3>
</sect2>
</sect1>
</webpage>

