Skip to content

Commit 05c2ade

Browse files
authored
Merge pull request #9 from qgis/update-readme
Update the readme
2 parents fa9473f + 0af80cc commit 05c2ade

File tree

3 files changed

+285
-2
lines changed

3 files changed

+285
-2
lines changed

README.md

+285-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,290 @@
11
# QGIS UC Website
22

3-
![Screenshot](./img/qgis-uc-website.png)
3+
![Screenshot](./img/qgis-uc-website.webp)
44

55
By Tim Sutton and QGIS Contributors.
66

7-
## TODO: Update the README
7+
## Project Status
8+
9+
[![E2E Tests](https://github.com/qgis/QGIS-UC-Website/actions/workflows/playwright-e2e.yml/badge.svg)](https://github.com/qgis/QGIS-UC-Website/actions/workflows/playwright-e2e.yml)
10+
[![Deploy Hugo site to Pages](https://github.com/qgis/QGIS-UC-Website/actions/workflows/github-pages.yml/badge.svg)](https://github.com/qgis/QGIS-UC-Website/actions/workflows/github-pages.yml)
11+
![Website Status](https://img.shields.io/website-up-down-green-red/http/qgis.github.io/QGIS-UC-Website.svg)
12+
![License](https://img.shields.io/github/license/qgis/QGIS-UC-Website.svg)
13+
14+
![](https://img.shields.io/github/issues/qgis/QGIS-UC-Website.svg)
15+
![](https://img.shields.io/github/issues-closed/qgis/QGIS-UC-Website.svg)
16+
![](https://img.shields.io/github/issues-pr/qgis/QGIS-UC-Website.svg)
17+
![](https://img.shields.io/github/issues-pr-closed/qgis/QGIS-UC-Website.svg)
18+
19+
20+
Project stars:
21+
![Stars](https://starchart.cc/qgis/QGIS-UC-Website.svg)
22+
23+
## 🏃Before you start
24+
25+
This web site is a static site built using [Hugo](https://gohugo.io/).
26+
27+
![Hugo Logo](./img/hugo-logo.png) and using the [hugo bulma blocks theme](https://github.com/kartoza/hugo-bulma-blocks-theme).
28+
29+
## 🛒 Getting the Code
30+
31+
development
32+
```
33+
git clone https://github.com/qgis/QGIS-UC-Website.git
34+
cd QGIS-UC-Website
35+
```
36+
37+
38+
## 🧑💻 Development
39+
40+
For Nix based development environment, please skip directly to the [Nix](#nix) section.
41+
42+
First install hugo for your local machine:
43+
44+
**📝 Note:** we need to install the 'extended' hugo version which includes a SASS compiler. If you don't install the extended version you will get errors like this when compiling:
45+
46+
```
47+
ERROR 2022/12/11 07:33:37 Rebuild failed: TOCSS: failed to transform
48+
"css/style.scss" (text/x-scss). Check your Hugo installation; you need
49+
the extended version to build SCSS/SASS.: this feature is not available
50+
in your current Hugo version, see https://goo.gl/YMrWcn for more information
51+
```
52+
53+
Currently, the website requires Hugo with a minimum version of `v0.139.0`. Ensure you have a compatible version installed to avoid any build issues.
54+
55+
You can find the extended version `v0.139.0` [here](https://github.com/gohugoio/hugo/releases/tag/v0.139.0).
56+
57+
58+
### 🐧 Linux:
59+
60+
Download the latest version and then do
61+
62+
``sudo dpkg -i hugo_extended_<latest>_linux-amd64.deb``
63+
64+
**📝 Note:** if your system has another version of Hugo, no need to mess up with docker, snap, nix. Just extract the binaries somewhere with `dpkg -x` .
65+
Example, assuming that you use a dedicated directory for your local binaries :
66+
67+
```sh
68+
mkdir -p ~/apps/hugo_139/
69+
wget https://github.com/gohugoio/hugo/releases/download/v0.139.0/hugo_extended_0.139.3_linux-amd64.deb --output-document ~/apps/hugo_128/hugo_extended_0.139.3_linux-amd64.deb
70+
dpkg -x hugo_extended_0.139.3_linux-amd64.deb
71+
~/apps/hugo_128/usr/local/bin/hugo server
72+
```
73+
74+
### 🪟 Windows
75+
76+
[Follow these notes](https://gohugo.io/installation/windows/#prebuilt-binaries)
77+
78+
### 🍏 macOS:
79+
80+
[Follow these notes](https://gohugo.io/installation/macos/#prebuilt-binaries)
81+
82+
### Nix
83+
84+
Run the following command on this project root folder:
85+
86+
```sh
87+
nix-shell # It will install all the dependecies
88+
hugo server # To run the local server
89+
```
90+
91+
92+
## ⚙️ Setting up VSCode
93+
94+
If you are using VSCode, I recommend the following extensions:
95+
96+
* Hugo Language and Syntax Support
97+
* Color Highlight
98+
99+
Clone the repo:
100+
101+
```
102+
git clone https://github.com/qgis/QGIS-UC-Website.git
103+
```
104+
105+
Run the site:
106+
107+
Press ```Ctl-Shift-D``` then choose the following runner:
108+
109+
'Run dev using locally installed Hugo'
110+
111+
the click the green triangle next to the runner to start it.
112+
113+
Once the site is running, you can open it at:
114+
115+
<http://localhost:1313>
116+
117+
The site will automatically refresh any page you have open if you edit it and save your work. Magical eh?
118+
119+
## Run in other IDEs
120+
121+
Use an appropriate Hugo plugin for your IDE, or run Hugo från the command line:
122+
123+
```shell
124+
hugo server
125+
```
126+
127+
You can then visit the hot-reloaded site in your browser at `http://localhost:1313/`
128+
129+
## Running Playwright End to End (e2e) Tests
130+
131+
Test files are located in ```playwright/ci-test/tests```.
132+
133+
These tests exist to make sure code changes to this repository do not break how the site currently functions.
134+
They are intended to run on each commit to verify the site is working in the expected order.
135+
136+
137+
### Run tests with VSCode
138+
139+
**Requirements:** NodeJS v18+
140+
141+
1. **Install playwright:** If you haven't already installed Playwright, you can do so by running the following commands in `playwright/ci-test` directory.
142+
143+
```bash
144+
cd playwright/ci-test
145+
npm install
146+
```
147+
148+
2. **Install playwright browsers:**
149+
150+
```bash
151+
npx playwright install --with-deps chromium
152+
```
153+
154+
3. **Install the extension [Playwright Test for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright)**: This extension provides a seamless integration of Playwright testing into VSCode.
155+
156+
157+
4. **Open the Testing Tab:** In VSCode, click on the Testing icon in the Activity Bar on the side of the window. This will open the Testing tab.
158+
159+
5. **Run Playwright Tests from the Testing Tab:**
160+
- In the Testing tab, you should see your Playwright tests listed. If not, ensure the browser is checked under Playwright > Project menu.
161+
- Click on the refresh button in the Testing tab to reload the tests.
162+
- You can run individual tests by clicking the play button next to the test name.
163+
- You can also run all tests by clicking the play button at the top of the Testing tab.
164+
165+
166+
6. **Debugging Tests:**
167+
168+
- You can debug individual tests by clicking the debug icon (a small bug with a play button) next to the test name.
169+
- Make sure to set breakpoints in your test files before running the debugger.
170+
171+
### Run tests with CLI
172+
173+
By default, this will run in `headless` mode just as it is in CI.
174+
175+
```bash
176+
./run-tests.sh
177+
```
178+
179+
**NOTE:** To run it in `UI` mode, add the `--ui` tag to the script.
180+
181+
```bash
182+
$PLAYWRIGHT \
183+
test \
184+
--ui \
185+
--project chromium
186+
```
187+
188+
Read more on testing [here](https://github.com/qgis/QGIS-Website/blob/main/playwright/ci-test/README.md).
189+
190+
### Running as github action
191+
192+
There is a github action that will run the tests automatically on PR submission, merge.
193+
194+
See ```.github/workflows/playwright-e2e.yml```
195+
196+
197+
## Search Functionality
198+
The search functionality uses both [FuseJS](https://fusejs.io/) and [MarkJS](https://markjs.io/).
199+
200+
The search functionality code is based on this [Blog Post](https://makewithhugo.com/add-search-to-a-hugo-site/) and [GitHub Gist](https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae) by [Eddie Webb](https://twitter.com/eddturtle).
201+
202+
Content folders need to be excluded from search, by making them [headless bundles](https://gohugo.io/content-management/page-bundles/#headless-bundle) - which we have done for the sustaining member and flagship user folders in content/. To make other content folders which are not rendered and included in search results, add an ```index.md``` file with the following content: ```headless = true```.
203+
204+
## Referencing URLs in templates
205+
206+
The site needs to work in production, where the links of the site are all below the root URL, and in staging, where the site is deployed to GitHub pages in a subpath. To ensure both deployment strategies work, please use the following method of constructing URLs in templates.
207+
208+
```html
209+
<a class="button is-primary" href="{{ "donate/" | absURL }}">
210+
```
211+
212+
**Note:** We do not use a leading slash, only an ending slash.
213+
214+
## Styles (SASS/CSS)
215+
216+
SASS for most components is stored in themes/hugo-bulma-blocks-theme/assets/sass/bulma/components/
217+
218+
Some common styles are places in themes/hugo-bulma-blocks-theme/assets/sass/style.sass - this file is compiled as hugo template, hence has access to config.toml variables and hugo macroses
219+
220+
Also some bulma theme overrides are placed in themes/hugo-bulma-blocks-theme/assets/css/custom.css
221+
222+
## 📁 File naming conventions
223+
224+
* Separate words in file names with hyphens e.g. windows-download.md
225+
* Avoid abbreviations in the words of your files
226+
* Write file names in lower case only
227+
* No spaces in file names
228+
229+
230+
## 💮 Changing the templates
231+
232+
| Page type | Path |
233+
| --------------- | ---------------------------------------- |
234+
| Landing Page | themes/qgis/layouts/index.html |
235+
| Top Level Pages | themes/qgis/layouts/_default/single.html |
236+
237+
## 🏠 Editing the landing (home) page
238+
239+
The layout of the landing page is themes/hugo-bulma-blocks-theme/layouts/index.html: the main page has many diverse blocks, that are not used anywhere else, hence its content is mostly in the partials.
240+
241+
The ``content/_index.md`` contains the front matter of the page and the contents for the `feature` shortcodes. Just edit whatever you like there. The blocks shortcodes are described [here](https://github.com/qgis/QGIS-Website/blob/main/docs/shortcodes.md)
242+
243+
244+
## 📃 Adding a top level page
245+
246+
### Create the content
247+
248+
Content pages are stored in the ``content`` folder. The top level documents there will be rendered with the top level page theming.
249+
250+
For example to add an about page, create ``content/about.md``
251+
252+
The page will be accessible then at /about/
253+
254+
### 🖼️ Referencing Images and Media
255+
256+
Place images and media in ```static/img```. Everything in ```static``` is referenced
257+
from the top level of the site e.g. ```static/img/foo.png``` would be referenced in
258+
markdown as ```/img/foo.png```.
259+
260+
## 📦 Blocks Shortcodes
261+
262+
The site uses a number of shortcodes to create reusable blocks of content. These are defined in the ```themes/hugo-bulma-blocks-theme/layouts/shortcodes/``` folder.
263+
264+
The shortcodes with screenshots are described [here](https://github.com/qgis/QGIS-Website/blob/main/docs/shortcodes.md)
265+
266+
<!-- 3rd level header with icon with title Reusable header web component -->
267+
### Reusable header web component
268+
269+
TODO
270+
271+
### Sidebar
272+
273+
Sidebar is implemented in themes/hugo-bulma-blocks-theme/layouts/partials/sidebar.html
274+
275+
Items are retrieved from config.toml under `[menu]` section. `weight` parameter defines the order of the item.
276+
277+
To enable sidebar on the content page, use the following template:
278+
279+
```
280+
---
281+
type: "page"
282+
...
283+
sidebar: true
284+
---
285+
{{< content-start >}}
286+
287+
... add content here ...
288+
289+
{{< content-end >}}
290+
```

img/qgis-uc-website.png

-4.83 MB
Binary file not shown.

img/qgis-uc-website.webp

199 KB
Binary file not shown.

0 commit comments

Comments
 (0)