When starting, make sure you bootstrap your site with the "minimal" install profile and the default config that ships with this repository:
drush si minimal --existing-config
Drupal 10 version
This is a sample Drupal site repository. It contains all the basics to get you started with a brand new Drupal 10 site that uses the UN-OCHA Common Design theme.
See https://humanitarian.atlassian.net/browse/OPS-7611
Use composer create-project
to install after cloning or composer create-project unocha/starterkit
Then run scripts/setup.sh
(see What to change? below).
The Drupal 9 version is in the D9 branch.
Several files need to be changed to replace starterkit
with your project name etc.
You can run the scripts/setup.sh
script to do that for you.
./scripts/setup.sh "site.prod.url" "Site Name" "project-name"
For example, for Common Design site:
./scripts/setup.sh "web.brand.unocha.org" "Common Design" "common-design-site"
The setup script will also copy a github action to build docker images on develop
, feature
and main
branches.
Well, obviously, this README file needs to be updated with information relevant to your project.
Edit the following files, replacing starterkit
with your project name (ex: my-website
):
Edit the following files:
- docker/Dockerfile --> change
starterkit.prod
to your production site URL. - Makefile --> change
starterkit
to your project name (ex:my-website
).
Edit the composer.json
file with your project name, authors etc.
Use composer require package
and composer remove package
to add/remove packages (ex: drupal/group
).
Edit the following files, replacing starterkit
with your project name (ex: my-website
):
Edit the Drupal site configuration to set up the site name (can be done via the Drupal UI as well).
See the Running the site section below.
Here's a list of commonly used modules among the UN-OCHA websites.
Used with the Common Design theme.
For logging in through HID
Prevent login as user 1
Faster and more memory efficient image handling
For better urls
Automatically “block” inactive users
Many UN-OCHA websites use the paragraphs
module and related ones to structure the content of the site.
This is enabled by default as of 2023-01-19.
Layout Paragraphs provide better editor UX for Paragraphs.
Use these Form Display settings for each Paragraphs field you add to the site:
- Preview view mode: Preview
- Maximum nesting depth: 0
- Require paragraphs to be added inside a layout: FALSE (unchecked)
- Placeholder message when field is empty: [blank string]
To help search engines index your website, the xmlsitemap
can help generate and submit a site map of your content.
This is enabled by default as of 2023-01-19 but no sitemap is configured.
Note: you may want to edit the assets/robots.txt.append file to indicate the URL of your sitemap:
# Sitemap
Sitemap: https://my-website-domain/sitemap.xml
The group
and related modules help create collections of content and users with specific access control permissions.
The theme_switcher
module helps control which theme to use on which pages.
The field_group
module helps organizing fields in a form.
See the patches/notes.md about Drupal 10 compatibility patches etc.
You should create a proper standard environment stack to run your site.
But in the meantime the local directory contains what is necessary to quickly create a set of containers to run your site locally.
Run ./local/install.sh -h
to see the script options.
- Update dependendices etc. in the composer.json file
- Create a local instance by running
./local/install.sh -m -i -c
- Log in this new instance and enable/disable/configure the modules and site
- Export the configuration (ex:
docker exec -it starterkit-local-site drush cex
) - Create a Pull Request with the changes
- Stop and remove the containers with
./local/install.sh -x -v
Note: do not forget to set up your local proxy to manage the starterkit-local.test
domain.