diff --git a/content/templates/jinja2/base.html b/content/templates/jinja2/base.html index 32adca0..6ef5680 100644 --- a/content/templates/jinja2/base.html +++ b/content/templates/jinja2/base.html @@ -1,82 +1,16 @@ -{% from "blocks/block.html" import block %} -{% from "widgets/generic.html" import page_header %} - - - - - {% for key, value in object.metadata.items()|filter_opengraph_metadata %} - - {% endfor %} {{ object.title|default("") }} - - - - - - - - - {{ block( - NAME = "navbar", - VERSION = object.metadata.lang|default(""), - DEFAULT_NAME = "fr/navbar.html" -) }} - -
- {{ page_header( - PRIMARY_TITLE = object.metadata.page_header_h1|default(""), - SECONDARY_TITLE = object.metadata.page_header_h2|default(""), - THIRD_TITLE = object.metadata.page_header_h3|default("") - ) }} -
- -
{% block content %}{% endblock %} -
- -{{ block( - NAME = "footer", - VERSION = object.metadata.lang|default(""), - DEFAULT_NAME = "fr/footer.html" -) }} - - - - - - - - - - - diff --git a/content/templates/jinja2/post-list.html b/content/templates/jinja2/post-list.html index 256af72..c51c2f1 100644 --- a/content/templates/jinja2/post-list.html +++ b/content/templates/jinja2/post-list.html @@ -1,91 +1,82 @@ {% extends "base.html"%} + {% block content %} -
- +
+
-
-{% for post in object.posts %} -
-
-
-
- -

{{ post.title }}

-
+
+ {% for post in object.posts %} +
+ +

{{ post.title }}

+
-
-

{{ post.metadata.abstract }}

-
+
+

{{ post.metadata.abstract }}

+
-
-
-
-
-
{{post.metadata.author}}
-
+
+
+
+ {{post.metadata.author}} +
-
-
-
{{ post.timestamp.strftime("%d/%m/%Y") }}
-
+
+ {{ post.timestamp.strftime("Le %d/%m/%Y à %Hh%M") }} +
-
- - Lire la suite ... - + -
-
-
+
+ {{post.metadata.abstract}} +
-
-{% endfor %} + {% endfor %}
{% if object.nb_pages > 1 %} -
- {% if object.page > 1 %} - {% if object.category != "" %} - Page précédente - {% else %} - Page précédente - {% endif %} - {% endif %} +


+
+ {% if object.page > 1 %} + {% if object.category != "" %} + Page précédente + {% else %} + Page précédente + {% endif %} + {% endif %} - {% if object.page < object.nb_pages %} - {% if object.category != "" %} - Page suivante - {% else %} - Page suivante - {% endif %} - {% endif %} -
+ {% if object.page < object.nb_pages %} + {% if object.category != "" %} + Page suivante + {% else %} + Page suivante + {% endif %} + {% endif %} +
-
- Pages : - {% for page in range(1, object.nb_pages+1) %} - {% if object.category != "" %} - {{page}} - {% else %} - {{page}} - {% endif %} - {% endfor %} -
+
+ Pages : + {% for page in range(1, object.nb_pages+1) %} + {% if object.category != "" %} + {{page}} + {% else %} + {{page}} + {% endif %} + {% endfor %} +
{% endif %} {% endblock %} \ No newline at end of file diff --git a/exemple-content/pages/en/home.md b/exemple-content/pages/en/home.md new file mode 100644 index 0000000..94e4b92 --- /dev/null +++ b/exemple-content/pages/en/home.md @@ -0,0 +1,23 @@ +--- +title Welcome on my site ! +slug home +lang en +description Home page + +page_header_h1 Welcome ! +page_header_h2 This is a example site for JFME +--- +{ + +} +--- + +{% markdown %} +**Here an image of tux :** +{% endmarkdown%} + +{{ + page_widgets.image( + IMAGE_PATH = static("images/tux.png"), + ) +}} \ No newline at end of file diff --git a/exemple-content/pages/fr/accueil.md b/exemple-content/pages/fr/accueil.md new file mode 100644 index 0000000..ffcafae --- /dev/null +++ b/exemple-content/pages/fr/accueil.md @@ -0,0 +1,22 @@ +--- +title Bienvenue sur mon site ! +slug accueil +lang fr + +page_header_h1 Bienvenue ! +page_header_h2 Un exemple de site pour JFME +--- +{ + +} +--- + +{% markdown %} +**Voilà une image de Tux :** +{% endmarkdown%} + +{{ + page_widgets.image( + IMAGE_PATH = static("images/tux.png"), + ) +}} \ No newline at end of file diff --git a/exemple-content/posts/fifth-post.md b/exemple-content/posts/fifth-post.md new file mode 100644 index 0000000..01fa3c0 --- /dev/null +++ b/exemple-content/posts/fifth-post.md @@ -0,0 +1,20 @@ +--- +title Fifth post +slug post5 +date 2024-08-09T13:02 +abstract An example of post for JFME +author Clément Becquet +category test 2 +--- +{ + +} +--- + +This post is just an example + +{% markdown %} +**This is my fifth post !** +{% endmarkdown %} + +{{ lipsum() }} \ No newline at end of file diff --git a/exemple-content/posts/first-post.md b/exemple-content/posts/first-post.md new file mode 100644 index 0000000..d0c5531 --- /dev/null +++ b/exemple-content/posts/first-post.md @@ -0,0 +1,20 @@ +--- +title First post +slug post1 +date 2024-08-09T12:13 +abstract An example of post for JFME +author Clément Becquet +category test 1 +--- +{ + +} +--- + +This post is just an example + +{% markdown %} +**This is my first post !** +{% endmarkdown %} + +{{ lipsum() }} \ No newline at end of file diff --git a/exemple-content/posts/fourth-post.md b/exemple-content/posts/fourth-post.md new file mode 100644 index 0000000..601c4b4 --- /dev/null +++ b/exemple-content/posts/fourth-post.md @@ -0,0 +1,20 @@ +--- +title Fourth post +slug post4 +date 2024-08-09T12:48 +abstract An example of post for JFME +author Clément Becquet +category test 1 +--- +{ + +} +--- + +This post is just an example + +{% markdown %} +**This is my fourth post !** +{% endmarkdown %} + +{{ lipsum() }} \ No newline at end of file diff --git a/exemple-content/posts/second-post.md b/exemple-content/posts/second-post.md new file mode 100644 index 0000000..7f5e1fd --- /dev/null +++ b/exemple-content/posts/second-post.md @@ -0,0 +1,20 @@ +--- +title Second post +slug post2 +date 2024-08-09T12:20 +abstract An example of post for JFME +author Clément Becquet +category test 2 +--- +{ + +} +--- + +This post is just an example + +{% markdown %} +**This is my second post !** +{% endmarkdown %} + +{{ lipsum() }} \ No newline at end of file diff --git a/exemple-content/posts/sixth-post.md b/exemple-content/posts/sixth-post.md new file mode 100644 index 0000000..6ef3d57 --- /dev/null +++ b/exemple-content/posts/sixth-post.md @@ -0,0 +1,20 @@ +--- +title Sixth post +slug post6 +date 2024-08-09T13:55 +abstract An example of post for JFME +author Clément Becquet +category test 1 +--- +{ + +} +--- + +This post is just an example + +{% markdown %} +**This is my sixth post !** +{% endmarkdown %} + +{{ lipsum() }} \ No newline at end of file diff --git a/exemple-content/posts/third-post.md b/exemple-content/posts/third-post.md new file mode 100644 index 0000000..c56d0d1 --- /dev/null +++ b/exemple-content/posts/third-post.md @@ -0,0 +1,20 @@ +--- +title Third post +slug post3 +date 2024-08-09T12:36 +abstract An example of post for JFME +author Clément Becquet +category test 1 +--- +{ + +} +--- + +This post is just an example + +{% markdown %} +**This is my third post !** +{% endmarkdown %} + +{{ lipsum() }} \ No newline at end of file diff --git a/exemple-content/static/css/styles.css b/exemple-content/static/css/styles.css new file mode 100644 index 0000000..29f9f7d --- /dev/null +++ b/exemple-content/static/css/styles.css @@ -0,0 +1,23 @@ +.container { + margin: 50px; + width: 800px; +} + +.box { + border: solid darkblue; + padding: 20px; +} + +.posts { + display: flex; + flex-wrap: wrap; +} + +.post-card { + margin: 20px; + width: 200px; + border: solid black; + border-width: 2px; + border-radius: 30px; + padding: 10px; +} \ No newline at end of file diff --git a/exemple-content/static/images/tux.png b/exemple-content/static/images/tux.png new file mode 100644 index 0000000..1a7c334 Binary files /dev/null and b/exemple-content/static/images/tux.png differ diff --git a/exemple-content/templates/jinja2/base.html b/exemple-content/templates/jinja2/base.html new file mode 100644 index 0000000..fc7ebbe --- /dev/null +++ b/exemple-content/templates/jinja2/base.html @@ -0,0 +1,59 @@ +{% from "blocks/block.html" import block %} +{% from "widgets/page_widgets.html" import header %} + + + + + + + + + + + {% for key, value in object.metadata.items()|filter_opengraph_metadata %} + + {% endfor %} + {{ object.title|default("") }} + + + + + + + +
+{{ block( + NAME = "navbar", + VERSION = object.metadata.lang|default(""), + DEFAULT_NAME = "en/navbar" +)}} +
+ +
+
+ {{ header( + PRIMARY_TITLE = object.metadata.page_header_h1|default(""), + SECONDARY_TITLE = object.metadata.page_header_h2|default(""), + THIRD_TITLE = object.metadata.page_header_h3|default("") + ) }} +
+
+ +
+
+ {% block content %} + {% endblock %} +
+
+ +
+{{ block( + NAME = "footer" +) }} +
+ + + + + + diff --git a/exemple-content/templates/jinja2/blocks/en/navbar.html b/exemple-content/templates/jinja2/blocks/en/navbar.html new file mode 100644 index 0000000..4d058bd --- /dev/null +++ b/exemple-content/templates/jinja2/blocks/en/navbar.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/exemple-content/templates/jinja2/blocks/footer.html b/exemple-content/templates/jinja2/blocks/footer.html new file mode 100644 index 0000000..4c4f2cc --- /dev/null +++ b/exemple-content/templates/jinja2/blocks/footer.html @@ -0,0 +1,5 @@ +
+ Home + Accueil + Blog +
\ No newline at end of file diff --git a/exemple-content/templates/jinja2/blocks/fr/navbar.html b/exemple-content/templates/jinja2/blocks/fr/navbar.html new file mode 100644 index 0000000..25779aa --- /dev/null +++ b/exemple-content/templates/jinja2/blocks/fr/navbar.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/exemple-content/templates/jinja2/post-list.html b/exemple-content/templates/jinja2/post-list.html new file mode 100644 index 0000000..3046777 --- /dev/null +++ b/exemple-content/templates/jinja2/post-list.html @@ -0,0 +1,79 @@ +{% extends "base.html"%} + +{% block content %} + +
+ +
+ +
+ {% for post in object.posts %} +
+ +

{{ post.title }}

+
+ +
+

{{ post.metadata.abstract }}

+
+ +
+
+
+ {{post.metadata.author}} +
+ +
+ {{ post.timestamp.strftime("Le %d/%m/%Y à %Hh%M") }} +
+
+ + +
+
+ {% endfor %} +
+ +{% if object.nb_pages > 1 %} +


+
+ {% if object.page > 1 %} + {% if object.category != "" %} + Page précédente + {% else %} + Page précédente + {% endif %} + {% endif %} + + {% if object.page < object.nb_pages %} + {% if object.category != "" %} + Page suivante + {% else %} + Page suivante + {% endif %} + {% endif %} +
+ +
+ Pages : + {% for page in range(1, object.nb_pages+1) %} + {% if object.category != "" %} + {{page}} + {% else %} + {{page}} + {% endif %} + {% endfor %} +
+{% endif %} + +{% endblock %} \ No newline at end of file diff --git a/exemple-content/templates/jinja2/widgets/page_widgets.html b/exemple-content/templates/jinja2/widgets/page_widgets.html new file mode 100644 index 0000000..ec5e5c4 --- /dev/null +++ b/exemple-content/templates/jinja2/widgets/page_widgets.html @@ -0,0 +1,33 @@ +{% macro header( + PRIMARY_TITLE = "", + SECONDARY_TITLE = "", + THIRD_TITLE = "" +) %} + +{% if PRIMARY_TITLE or SECONDARY_TITLE or THIRD_TITLE %} +
+ {% if PRIMARY_TITLE %} +

{{ PRIMARY_TITLE }}

+ {% endif %} + {% if SECONDARY_TITLE %} +

{{ SECONDARY_TITLE }}

+ {% endif %} + {% if THIRD_TITLE %} +

{{ THIRD_TITLE }}

+ {% endif %} +
+{% endif %} + +{% endmacro %} + + + +{% macro image( + IMAGE_PATH = "" +) %} + +
+ Image not found +
+ +{% endmacro %} \ No newline at end of file diff --git a/jssg/settings.py b/jssg/settings.py index 304502a..cab77d9 100644 --- a/jssg/settings.py +++ b/jssg/settings.py @@ -44,8 +44,8 @@ ALLOWED_HOSTS = ["exemple.org", "localhost"] # JSSG -JFME_DOMAIN = "www.galae.net" -JFME_CONTENT_DIRS = [BASE_DIR / "content"] + [BASE_DIR / "galae-content"] + [BASE_DIR / "common-content"] +JFME_DOMAIN = "www.exemple.com" +JFME_CONTENT_DIRS = [BASE_DIR / "exemple-content"] + [BASE_DIR / "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] @@ -55,9 +55,10 @@ 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 -JFME_INDEX_PAGE = "fr-index" +JFME_INDEX_PAGE = "en/home" JFME_ADDITIONAL_JINJA2_FUNCTIONS = {} JFME_ADDITIONAL_JINJA2_FILTERS = {} + #Django sites and sitemap app SITE_ID = 1