Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

core: Add a basesite skeleton site.

Furthermore, make it easier to overrule mod_base_site styles by
including an empty site.css file which the basesite skeleton
overrules.

Also documented the four available skeleton sites.
  • Loading branch information...
commit dfa7f6055f4bbe4929c5cddc56ac80284932c6b4 1 parent 7cd5127
Arjan Scherpenisse arjan authored
47 doc/tutorials/install-addsite.rst
View
@@ -27,13 +27,16 @@ called ``yoursite``.
bin/zotonic addsite -s blog yoursite
- .. note:: zotonic has to be running for the addsite command to succeed.
+ .. note:: Zotonic has to be running for the `addsite` command to succeed.
- This will add a site named yoursite. Its default URL will be
- http://yoursite:8000/ so either put 'yoursite' in your hosts file
- or change the {hostname} section of the config file.
+ This will add a site named `yoursite`. Its default URL will be
+ http://yoursite:8000/ so either put 'yoursite' in your hosts file as stated above,
+ or change the ``{hostname}`` section of the site's config file.
-4. Edit the generated file priv/sites/yoursite/config, to make sure
+ Look at :ref:`skeleton-sites` to see which other skeletons are
+ available to base your site on.
+
+4. Edit the generated file ``priv/sites/yoursite/config``, to make sure
your database credentials and the hostname are correct, and change
the password for the admin.
@@ -53,3 +56,37 @@ called ``yoursite``.
To learn more about how sites work and what consists of a
:term:`Zotonic site`, please see the in-depth manual,
:ref:`manual-site-anatomy`.
+
+
+.. _skeleton-sites:
+
+Available skeleton sites
+------------------------
+
+Zotonic comes with four different skeletons to base your site on.
+
+
+``blog``
+ As a full example of a Zotonic website, it installs a front page
+ with a listing of recent articles. As default example data, three
+ example articles and a couple of images are also installed.
+
+``basesite``
+ A skeleton site which lets you build a site on top of
+ :ref:`mod_base_site`. Its site directory is pretty empty, as
+ `mod_base_site` itself implements most of the frontend templates
+ that are needed. This skeleton does install a custom homepage
+ template as ``home.tpl`` and dispatch rule to serve it. It also adds
+ a `site.css` file for tweaking fonts, colors, et cetera.
+
+``empty``
+ An empty skeleton. No templates or dispatch rules whatsoever are
+ created. You can use this skeleton to create a new site based on
+ your own base templates, a custom CSS framework, etc.
+
+``nodb``
+ Like the `empty` template, but this skeleton does not require a
+ database connection. As such, the admin and content management
+ interface is disabled, as those modules all require a database
+ connection.
+
1  modules/mod_base_site/lib/css/site.css
View
@@ -0,0 +1 @@
+/* Placeholder CSS file. Override this one in your site. */
1  modules/mod_base_site/templates/phone/base.tpl
View
@@ -19,6 +19,7 @@
"css/jquery.loadmask.css"
"css/z.growl.css"
"css/z.modal.css"
+ "css/site.css"
%}
{% block html_head_extra %}{% endblock %}
</head>
1  modules/mod_base_site/templates/phone/base_fullscreen.tpl
View
@@ -16,6 +16,7 @@
"bootstrap/css/bootstrap.css"
"bootstrap/css/bootstrap-responsive.css"
"bootstrap/css/bootstrap-base-site.css"
+ "css/site.css"
%}
{% block html_head_extra %}{% endblock %}
<style type="text/css">
1  modules/mod_base_site/templates/tablet/base.tpl
View
@@ -19,6 +19,7 @@
"css/jquery.loadmask.css"
"css/z.growl.css"
"css/z.modal.css"
+ "css/site.css"
%}
{% block html_head_extra %}{% endblock %}
</head>
31 priv/skel/basesite/SITE.erl
View
@@ -0,0 +1,31 @@
+%% @author %%FULLNAME%%
+%% @copyright %%YEAR%% %%FULLNAME%%
+%% Generated on %%DATE%%
+%% @doc This site was based on the 'empty' skeleton.
+
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+
+-module(%%SITE%%).
+-author("%%FULLNAME%%").
+
+-mod_title("%%SITE%% zotonic site").
+-mod_description("An empty Zotonic site, to base your site on.").
+-mod_prio(10).
+
+-include_lib("zotonic.hrl").
+
+
+%%====================================================================
+%% support functions go here
+%%====================================================================
+
66 priv/skel/basesite/config.in
View
@@ -0,0 +1,66 @@
+% Zotonic site configuration for %%SITE%%.
+[
+ % This site is enabled or not.
+ {enabled, true},
+
+ % Hostname on which this site runs
+ {hostname, "%%SITE%%:8000"},
+
+ % Aliases which should redirect to the primary hostname
+ %{hostalias, "www.example.com"},
+ %{hostalias, "example.com"},
+
+ % PostgreSQL database connection
+ {dbhost, "%%DBHOST%%"},
+ {dbport, %%DBPORT%%},
+ {dbuser, "%%DBUSER%%"},
+ {dbpassword, "%%DBPASSWORD%%"},
+ {dbdatabase, "%%DBDATABASE%%"},
+ {dbschema, "%%DBSCHEMA%%"},
+
+ % Depcache settings. The maximum size in Mbs
+ {depcache_memory_max, 100},
+
+ % Password for the 'admin' user.
+ {admin_password, "%%ADMINPASSWORD%%"},
+
+ % What skeleton site this site is based on; for installing the initial data.
+ {skeleton, %%SKEL%%},
+
+ {install_modules,
+ [
+ mod_base,
+ mod_base_site,
+ mod_menu,
+ mod_oauth,
+ mod_search,
+ mod_oembed,
+ mod_atom_feed,
+ mod_translation,
+ mod_signal,
+ mod_logging,
+
+ mod_seo,
+ mod_seo_google,
+ mod_seo_sitemap,
+
+ mod_authentication,
+ mod_acl_adminonly,
+
+ mod_admin,
+ mod_admin_category,
+ mod_admin_config,
+ mod_admin_identity,
+ mod_admin_modules,
+ mod_admin_predicate,
+
+ mod_l10n,
+ mod_geomap,
+
+ mod_comment,
+ mod_artwork,
+ mod_bootstrap
+ ]},
+
+ {title, "A default Zotonic website"}
+].
5 priv/skel/basesite/dispatch/dispatch
View
@@ -0,0 +1,5 @@
+%% -*- mode: erlang -*-
+%% Put your dispatch rules here.
+[
+ {home, [], controller_template, [ {template, "home.tpl"} ]}
+].
1  priv/skel/basesite/files/archive/.empty
View
@@ -0,0 +1 @@
+
1  priv/skel/basesite/files/dropbox/.empty
View
@@ -0,0 +1 @@
+
1  priv/skel/basesite/files/preview/.empty
View
@@ -0,0 +1 @@
+
1  priv/skel/basesite/files/processing/.empty
View
@@ -0,0 +1 @@
+
1  priv/skel/basesite/files/unhandled/.empty
View
@@ -0,0 +1 @@
+
0  priv/skel/basesite/lib/css/.empty
View
No changes.
7 priv/skel/basesite/lib/css/site.css
View
@@ -0,0 +1,7 @@
+/* Define your site-specific styles here. */
+
+/* fix vertical alignment of Zotonic logo */
+nav.navbar a.brand img {
+ vertical-align: -2px;
+ padding-right: 8px;
+}
0  priv/skel/basesite/lib/images/.empty
View
No changes.
BIN  priv/skel/basesite/lib/images/logo.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 priv/skel/basesite/templates/home.tpl
View
@@ -0,0 +1,21 @@
+{% extends "base.tpl" %}
+
+{% block title %}{{ m.site.title }}{% endblock %}
+
+{% block main %}
+
+<div class="hero-unit">
+ <h1>{{ m.rsc.page_home.title }}</h1>
+ <p>{{ m.rsc.page_home.summary }}</p>
+ {% button class="pull-right btn btn-primary btn-large" action={redirect dispatch=`admin`} text=_"Visit Admin Interface" %}
+</div>
+
+{{ m.rsc.page_home.body }}
+
+{% button class="btn btn-info" action={redirect dispatch=`admin_edit_rsc` id=`page_home`} text=_"Edit this page" %}
+
+{% endblock %}
+
+{% block subnavbar %}
+{% include "_content_list.tpl" list=m.search[{query sort='-rsc.modified' pagelen=10}] title=_"Recent content" %}
+{% endblock %}
19 src/install/z_install_defaultdata.erl
View
@@ -29,8 +29,23 @@
]).
+install(basesite, Context) ->
+ Datamodel = #datamodel{
+ resources =
+ [
+ {page_home,
+ text,
+ [{title, <<"Home">>},
+ {summary, <<"Welcome to your new site!">>},
+ {page_path, <<"/">>}]
+ }
+ ]
+ },
+ ?DEBUG("Installing basesite data"),
+ z_datamodel:manage(?MODULE, Datamodel, Context);
+
install(blog, Context) ->
- Now = {{2010,04,03},{9,12,0}},
+ Now = {{2012,12,14},{9,12,0}},
Datamodel =
#datamodel{
resources =
@@ -137,7 +152,7 @@ install(blog, Context) ->
]
},
- ?DEBUG("Installin blog data"),
+ ?DEBUG("Installing blog data"),
z_datamodel:manage(?MODULE, Datamodel, Context);

5 comments on commit dfa7f60

Andreas Stenius
Owner

I would prefer to have the list of modules to install for skeletons in z_install_data.
That way you can get the list of modules for different skeletons simply by choosing that skeleton in your site config file, without the hassle of copying the list of modules from the skel config file.. ;)

Andreas Stenius
Owner

seeing that the list of modules are nearly identical to that of the blog skeleton.. (with the exception of mod_artwork, which maybe should go into blog too..? making them entirely identical) it could be handy if the {install_modules, [...]} could take a {skeleton, foo} among the module names to inherit the list of modules from another skeleton..

EDIT: I looked at the blog skeleton, not the empty skeleton.

Andreas Stenius
Owner

Implemented the {skeleton, foo} option in dd79563.

Marc Worrell
Owner

I think that mod_artwork could be enabled by default.
Many handy icons etc in there.

Andreas Stenius
Owner

OK, I'll add it to the blog skeleton.

Please sign in to comment.
Something went wrong with that request. Please try again.