Skip to content

Commit

Permalink
Add reference of JSSG in readme
Browse files Browse the repository at this point in the history
Rename settings
  • Loading branch information
Clément committed Jul 8, 2024
1 parent a8599d2 commit 0a240f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# JFM-Engine


Today, it's a django app that can generate a static website with Vite & Typescript integration.

## Bootstrap
Expand Down Expand Up @@ -52,18 +51,18 @@ $ sudo docker compose up
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
- `JFME_DOMAIN` : the domain name of your website, for instance `"https://www.example.com"` (used in sitemap file)
- `JFME_CONTENT_DIRS` : a list of directories where to look for the site content

### `Dockerfile` :
- In the `# Copy source dir` section, add `COPY <content-dir>/ <content-dir>/` for each content directory in `JSSG_CONTENT_DIR`
- In the `# Copy source dir` section, add `COPY <content-dir>/ <content-dir>/` for each content directory in `JFME_CONTENT_DIRS`

### `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 :
Each directory defined in `JFME_CONTENT_DIRS` has the following structure :
```
Content-dir/
|-- templates/
Expand Down Expand Up @@ -105,4 +104,5 @@ See the [Django doc](https://docs.djangoproject.com/en/5.0/howto/static-files/#c

## Others

This repo is a fork of https://github.com/jtremesay/jssg.git for algoo websites use cases.
JFM-Engine is a friendly fork of [JSSG](https://github.com/jtremesay/jssg/) made in agreement with the JSSG developer because of different goals. \
See the [issue #21](https://github.com/jtremesay/jssg/issues/21).
10 changes: 5 additions & 5 deletions jssg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Document:
"""

# Default dir to search document
BASE_DIR = settings.JSSG_CONTENT_DIR
BASE_DIR = settings.JFME_CONTENT_DIRS

def __init__(self, content: str, **metadata: Mapping[str, str]) -> None:
"""Create a new document.
Expand Down Expand Up @@ -222,7 +222,7 @@ def load_glob(
class Page(Document):
"""A webpage, with a title and some content."""

BASE_DIR = settings.JSSG_PAGES_DIR
BASE_DIR = settings.JFME_PAGES_DIRS

def __init__(self, content: str, **metadata) -> None:
"""Create a new page.
Expand Down Expand Up @@ -256,7 +256,7 @@ def get_pages(cls):
class Post(Page):
"""A webblog post."""

BASE_DIR = settings.JSSG_POSTS_DIR
BASE_DIR = settings.JFME_POSTS_DIRS

def __init__(self, content: str, **metadata) -> None:
"""Create a new post.
Expand All @@ -279,7 +279,7 @@ def get_posts(cls):
return ({"slug": p.slug} for p in Post.load_glob())

class Sitemap :
BASE_DIR = settings.JSSG_PAGES_DIR + settings.JSSG_POSTS_DIR
domain = settings.JSSG_DOMAIN
BASE_DIR = settings.JFME_PAGES_DIRS + settings.JFME_POSTS_DIRS
domain = settings.JFME_DOMAIN
pages_slugs = [p["slug"] for p in Page.get_pages()]
posts_slugs = [p["slug"] for p in Post.get_posts()]
18 changes: 9 additions & 9 deletions jssg/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
runserver.default_addr = '127.0.0.1'

# JSSG
JSSG_DOMAIN = "https://www.galae.net"
JSSG_CONTENT_DIR = [BASE_DIR / "content"] + [BASE_DIR / "galae-content"] + [BASE_DIR / "common-content"]
JSSG_PAGES_DIR = [path / "pages" for path in JSSG_CONTENT_DIR]
JSSG_POSTS_DIR = [path / "posts" for path in JSSG_CONTENT_DIR]
JSSG_TEMPLATES_DIR = [path / "templates" for path in JSSG_CONTENT_DIR]
JSSG_STATIC_DIR = [path / "static" for path in JSSG_CONTENT_DIR]
JFME_DOMAIN = "https://www.galae.net"
JFME_CONTENT_DIRS = [BASE_DIR / "content"] + [BASE_DIR / "galae-content"] + [BASE_DIR / "common-content"]
JFME_PAGES_DIRS = [path / "pages" for path in JFME_CONTENT_DIRS]
JFME_POSTS_DIRS = [path / "posts" for path in JFME_CONTENT_DIRS]
JFME_TEMPLATES_DIRS = [path / "templates" for path in JFME_CONTENT_DIRS]
JFME_STATIC_DIRS = [path / "static" for path in JFME_CONTENT_DIRS]



Expand All @@ -77,15 +77,15 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.jinja2.Jinja2",
"DIRS": [path / "jinja2" for path in JSSG_TEMPLATES_DIR],
"DIRS": [path / "jinja2" for path in JFME_TEMPLATES_DIRS],
"APP_DIRS": True,
"OPTIONS": {
"environment": "jssg.jinja2.environment"
},
},
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [path / "django" for path in JSSG_TEMPLATES_DIR],
"DIRS": [path / "django" for path in JFME_TEMPLATES_DIRS],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down Expand Up @@ -142,7 +142,7 @@

DIST_DIR = BASE_DIR / "dist"
STATIC_ROOT = BASE_DIR / "static"
STATICFILES_DIRS = JSSG_STATIC_DIR
STATICFILES_DIRS = JFME_STATIC_DIRS

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
Expand Down

0 comments on commit 0a240f7

Please sign in to comment.