-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc 17 add usage documentation #30
Merged
Merged
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
# JSSG - Jtremesay's Static Site Generator | ||
# JFM-Engine | ||
|
||
[![CI/CD](https://github.com/jtremesay/jssg/actions/workflows/main.yaml/badge.svg)](https://github.com/jtremesay/jssg/actions/workflows/main.yaml) | ||
|
||
The thing that propulse [jtremesay.org](https://jtremesay.org). | ||
|
||
Today, it's a django app that can generate a static website with Vite & Typescript integration. | ||
|
||
## Bootstrap | ||
|
||
```shell | ||
$ git clone https://github.com/jtremesay/jtremesay.org.git | ||
$ cd jtremesay.org | ||
$ git clone https://github.com/algoo/jssg.git | ||
$ cd jssg | ||
$ python3.9 -m venv env/ | ||
$ source env/bin/activate | ||
$ direnv allow | ||
|
@@ -44,10 +41,68 @@ $ ./manage.py distill-local --collectstatic --force dist | |
Or, if you prefer docker: | ||
|
||
```shell | ||
$ docker build -t jssg . | ||
$ sudo docker run -p 8080:80 jssg:latest | ||
$ sudo docker build -t jssg . | ||
$ sudo docker network create traefik_public | ||
$ sudo docker compose up | ||
``` | ||
|
||
## Config | ||
|
||
### `settings.py` : | ||
For django settings, see https://docs.djangoproject.com/en/5.0/ref/settings/ | ||
|
||
Otherwise, you have to configure the following settings : | ||
- `JSSG_DOMAIN` : the domain name of your website, for instance `"https://www.example.com"` (used in sitemap file) | ||
- `JSSG_CONTENT_DIR` : a list of directories where to look for the site content | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: if the var contains a list, then the naming should be explicit: By the way, I suggest to rename it to |
||
### `Dockerfile` : | ||
- In the `# Copy source dir` section, add `COPY <content-dir>/ <content-dir>/` for each content directory in `JSSG_CONTENT_DIR` | ||
|
||
### `views.py` : | ||
- In the `get_object` method of `IndexView`, set the `self.kwargs["slug"]` to the slug of your index page which is sent at the root of your site | ||
|
||
## Usage | ||
|
||
Each directory defined in `JSSG_CONTENT_DIR` has the following structure : | ||
``` | ||
Content-dir/ | ||
|-- templates/ | ||
| |-- django/ | ||
| | |-- blocks/ | ||
| | |-- widgets/ | ||
| |-- jinja2/ | ||
| |-- blocks/ | ||
| |-- widgets/ | ||
| |-- base.html | ||
| |-- page.html | ||
| |-- post.html | ||
| |-- sitemap.html | ||
|-- pages/ | ||
|-- posts/ | ||
|-- static/ | ||
``` | ||
|
||
### Templates : | ||
For Django engine, see https://docs.djangoproject.com/en/5.0/ref/templates/language/ \ | ||
For Jinja2 engine, see https://jinja.palletsprojects.com/en/2.11.x/templates/ | ||
|
||
`page.html` and `post.html` are the firsts templates called to render a page or a post. By default, they extend the `base.html` template. | ||
|
||
### Pages : | ||
Pages contain the content of each web page of the site at url `pages/<slug>.html`. They are `.md` files and are structured in 3 sections separated by a line starting with `---` : | ||
|
||
- **Metadata** provide some informartion about the page (description, language...). Each metadata is a key, some spaces, and a value. The `title` metadata is required for all pages. Other metadata can be useful, like `slug`, `lang`, `template_engine` or `og:<key>` (open graph). Metadata are accessible by a dictionary in `object.metadata` in templates. | ||
- **Data** is a section which contains a JSON text. It is accessible by `object.data` in templates. | ||
- **Body** : It is the concrete content of the page, that can be html or template content. For instance, it is possible to use widgets or blocks in this section. It is accessible by `object.content` in templates. | ||
|
||
### Posts : | ||
Like pages, they contain the content of each post at url `posts/<slug>.html`. They require an additional metadata `date` in ISO format | ||
|
||
### Static : | ||
This directory is for the static content, like images, CSS and JavaScript files ... \ | ||
It is accessible in templates by the Jinja or Django `static` function. \ | ||
See the [Django doc](https://docs.djangoproject.com/en/5.0/howto/static-files/#configuring-static-files) for static files, or the [Jinja2 version](https://docs.djangoproject.com/en/5.0/topics/templates/#module-django.template.backends.django). | ||
|
||
## Others | ||
|
||
This repo is a fork of https://github.com/jtremesay/jssg.git for algoo websites use cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an explanation, something like this: jsm-engine is a friendly fork of jssg made in agreement with the JSSG developer because of different goals. See jtremesay/jssg#21
Note: this explanation may be put at the end of the README. This is not the first information the user wants to read (but it's fair to put it on the project readme)