Skip to content

Commit

Permalink
change the settings for no pagination to <=0 value
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément committed Jul 26, 2024
1 parent 74e2823 commit 9c001fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Otherwise, you have to configure the following settings :
Other useful settings :
- Default metadata : `JFME_DEFAULT_METADATA_DICT` and `JFME_DEFAULT_METADATA_FILEPATH` allow to set default metadata for pages and posts. The first one is a python dictionary and the second one is a Path to a file having the same format as metadata section in pages.
The order, from less to most priority is : `JFME_DEFAULT_METADATA_DICT` then `JFME_DEFAULT_METADATA_FILEPATH` then page matadata.
- Posts pagination : `JFME_NUMBER_OF_POSTS_BY_PAGE` give the maximum number of posts in a posts list page. If not set, all posts will be in the first page.
- Posts pagination : `JFME_NUMBER_OF_POSTS_BY_PAGE` give the maximum number of posts in a posts list page. If set to 0 or -1, all posts will be in the first page.

### `Dockerfile` :
- In the `# Copy source dir` section, add `COPY <content-dir>/ <content-dir>/` for each content directory in `JFME_CONTENT_DIRS`
Expand Down
2 changes: 1 addition & 1 deletion jssg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def __init__(self, category = "", page = 1) -> None:
else :
nb_posts = len(list(filter(lambda p: p.metadata["category"] == self.category, Post.load_glob(all=True))))

if hasattr(settings, "JFME_NUMBER_OF_POSTS_BY_PAGE") :
if settings.JFME_NUMBER_OF_POSTS_BY_PAGE > 0 :
self.posts_by_page = settings.JFME_NUMBER_OF_POSTS_BY_PAGE
else :
self.posts_by_page = nb_posts
Expand Down
2 changes: 1 addition & 1 deletion jssg/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
JFME_STATIC_DIRS = [path / "static" for path in JFME_CONTENT_DIRS]
JFME_DEFAULT_METADATA_DICT = {"slug": "index", } # The order of include is : JFME_DEFAULT_METADATA_DICT then JFME_DEFAULT_METADATA_FILEPATH then page metadata
JFME_DEFAULT_METADATA_FILEPATH = BASE_DIR / "jssg" / "default_metadata.txt" # If a metadata is specified more than once, the last included is retained
JFME_NUMBER_OF_POSTS_BY_PAGE = 3 # no pagination of posts if not set
JFME_NUMBER_OF_POSTS_BY_PAGE = 3 # no pagination of posts if set to 0 or -1
JFME_CONTENT_REQUIRED_METADATA = ["title", "slug", "lang", "description"]
JFME_SITEMAP_LASTMOD_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z" # strftime format, see https://docs.python.org/fr/3.6/library/datetime.html#strftime-and-strptime-behavior, see https://www.sitemaps.org/protocol.html#lastmoddef for allowed datetime formats

Expand Down

0 comments on commit 9c001fb

Please sign in to comment.