unocha/starterkit

Starterkit

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 8

Forks: 1

Type:project

dev-develop 2024-05-08 12:32 UTC

README

TL;DR

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

Ok, but tell me more.

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.

What to change?

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.

README

Well, obviously, this README file needs to be updated with information relevant to your project.

Github workflows

Edit the following files, replacing starterkit with your project name (ex: my-website):

Docker

Edit the following files:

  • docker/Dockerfile --> change starterkit.prod to your production site URL.
  • Makefile --> change starterkit to your project name (ex: my-website).

Composer

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).

Tests

Edit the following files, replacing starterkit with your project name (ex: my-website):

Site configuration

Edit the Drupal site configuration to set up the site name (can be done via the Drupal UI as well).

Local stack

See the Running the site section below.

Recommended modules

Here's a list of commonly used modules among the UN-OCHA websites.

Paragraphs

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.

XML Sitemap

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

Groups

The group and related modules help create collections of content and users with specific access control permissions.

Theme switcher

The theme_switcher module helps control which theme to use on which pages.

Field groups

The field_group module helps organizing fields in a form.

Patches

See the patches/notes.md about Drupal 10 compatibility patches etc.

Running the site

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.

Updating this repository

  1. Update dependendices etc. in the composer.json file
  2. Create a local instance by running ./local/install.sh -m -i -c
  3. Log in this new instance and enable/disable/configure the modules and site
  4. Export the configuration (ex: docker exec -it starterkit-local-site drush cex)
  5. Create a Pull Request with the changes
  6. 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.