Skip to content
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

English blog support #131

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ nav:
- ... | preferences*.md
- zengin
- genome
- contribute
- contribute
- blog
8 changes: 8 additions & 0 deletions docs/blog/.authors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
authors:
kamilkrzyskow:
name: HRY
description: >
Enthusiast of hacky solutions. Python generalist, without AI or math <span class="twemoji"><img src="https://raw.githubusercontent.com/twitter/twemoji/master/assets/svg/1f605.svg"></span>
avatar: https://avatars.githubusercontent.com/u/34622465
slug: hry
url: https://github.com/Made-by-HRY
6 changes: 6 additions & 0 deletions docs/blog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Community Posts
icon: material/alert-decagram
---


67 changes: 67 additions & 0 deletions docs/blog/posts/community_news/welcome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
authors:
- kamilkrzyskow
date: 2024-07-02
categories:
- Community News
tags:
- Documentation
- i18n
- MkDocs
---
# Introducing Community Posts

> Enabled by the built-in Blog plugin of Material for MkDocs.
> [![Material for MkDocs][badge]{: .gmc-default-img}][mkdocs-material]

Welcome to the new blog section of the GMC, where users can share tutorials, guides, analytical
articles, useful snippets, promote their modding tools, and more.

This addition brings greater flexibility to content creation on our website.

<!-- more -->

[badge]: https://img.shields.io/badge/Material_for_MkDocs-526CFE?style=for-the-badge&logo=MaterialForMkDocs&logoColor=white
[mkdocs-material]: https://squidfunk.github.io/mkdocs-material/

## Why a blog?

Throughout the history of the Gothic Modding Community, we've encountered a recurring issue: some
content doesn't fit neatly into the "docs" format. To address this, we needed a new section.
Initially, we considered a simple new area, but then the Blog plugin was announced for the Community
version of the Material theme. We decided to wait for its release.

While waiting, we added support for i18n localization to attract new users for translation and
content creation. However, despite our efforts, we didn't gain many regular contributors.
Additionally, delays caused by the GitHub/PayPal issues further postponed the Blog plugin's release.

The Blog plugin eventually arrived in the Community version. Unfortunately, we discovered that the
mkdocs-static-i18n plugin couldn't handle the internally generated blog pages. We hoped for a fix
upstream, but the issue persisted.

## i18n support

!!! failure "Not supported"
As of July 02, 2024, the i18n plugin doesn't support blog pages.

Given the complexity of this issue, it likely requires overriding the Blog plugin's internal code.
This could prevent users with localization from updating, creating a problematic situation for
[@ultrabug], who would need to constantly make fixes. The issue is further complicated by different
versions of the Blog plugin for the Community and Insiders editions.

This applies to us as well. Despite many fixes and patches added to our docs on top of other
plugins, we don't plan to add i18n support for the blog ourselves to maintain general flexibility.
Especially since our community is still primarily composed of English speakers.

[@ultrabug]: https://github.com/ultrabug/

## Who can add posts, what topics are allowed?

We don't plan to restrict posts too much. As long as they are not meme content, they will likely be
accepted. For up-to-date guidelines, you can read the [how-to guide].

[how-to guide]: ../tutorials/how_to_write_blog_posts.md

## Comments

Let us know what do you think about the new feature!
130 changes: 130 additions & 0 deletions docs/blog/posts/tutorials/how_to_write_blog_posts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
authors:
- kamilkrzyskow
categories:
- Tutorials
date: 2024-07-01
tags:
- Best Practices
- Documentation
- How-To
- MkDocs
---
# Guidelines For Community Posts

**Question:** What are the requirements for my blog post to be added here?
**Answer:** There are almost no requirements, other than managing files properly.

Also read the general [contribution guide](../../../contribute/index.md) for setup instructions.

<!-- more -->

## Technical Requirements

### Creation Date

Each post must have a creation date used for sorting and ordering. The `date` key can be a simple
string with the creation date or, an object structure with sub-keys `created` and `updated`.

```yaml
date: 2024-07-01
```

[Reference](https://squidfunk.github.io/mkdocs-material/plugins/blog/#meta.date)

### At Least One Category

This blog uses category-based URLs instead of default time-based post URLs. The `categories` key is
a list of strings.

```yaml
categories:
- Tutorials
```

[Reference](https://squidfunk.github.io/mkdocs-material/plugins/blog/#meta.categories)

## Mandatory Opinionated Requirements

### Use Categories Defined in the mkdocs.yml Config

Some categories can be used for slugs, while others cannot. If you want to add a new one, please ask
first. To see an up-to-date list, check the `categories_allowed` option in the `mkdocs.yml` file.
For more granularity, use [tags], which offer more flexibility. You can see the index of used tags
[here][current-tags].

[tags]: https://squidfunk.github.io/mkdocs-material/plugins/tags/
[current-tags]: ../../tags.md

### Keep the Files Organized

Place posts in the `blog/posts` directory under a subdirectory matching the category slug (lowercase
with `_` in place of spaces):

> Filenames should use `_` for spaces and should be lowercase.

```
blog/posts/community_news/welcome.md
blog/posts/tutorials/how_to_write_blog_posts.md
```

For assets specific to the blog section:

> Note the lack of `posts`.

```
assets/blog/images/tutorials/image.png
```

### Assets Like Images Need to Be Placed Under the `overrides` Path

Due to the rest of the site using multiple languages (i18n), assets are kept in the overrides
directory to reduce duplication of files after the build. The overrides directory is placed on top
of the built directory so all relative paths are the same as if the files were in the `docs`
directory. Use a couple of `../` to get to the root of the built site and access the asset:

![](../../../assets/images/gmc_logo.png){: .gmc-default-img style="width: 2rem" }

```
../../../assets/images/gmc_logo.png
```

So in the example before:

```
../../../assets/blog/images/tutorials/image.png
```

## Optional Opinionated Recommendations

### Keep Keys and Values in the Front-Matter in Alphabetical Order

This will make it easier to spot mistakes.

### Maintain a Strict Line Width Limit

It will make it easier to read and spot mistakes in Markdown. `mkdocs-material` uses an 80-character
limit, which is a bit narrow. Currently, the CSS settings for the width of the content are roughly
~140 characters, which is a bit wide. This Markdown file uses a 100-character limit. Keep things
reasonable and use the same width throughout the file, and do not break lines prematurely.

### Use Alternative Link Definitions

To avoid issues with long lines, define links before the next heading using this syntax:
`[text]: url`. Then you can organically use the `[text]` in your paragraph, and it will be converted
to a URL, or use `[text][defined url]` to wrap the `text` using a defined URL.

### Avoid Name Conflicts

If a name conflict occurs, don't resort to adding a lazy `-2` at the end. Instead, ensure your name
is distinct for better searchability. For example, instead of `result.png`, use a more specific name
like `blender_modifier_result.png` or the slug of the blog post you're writing.

### Add a H2 Comments Heading at the Bottom

This will add a TOC element for users to easily skip the post and read the comments. The RSS plugin
also expects this heading to exist.

## Comments

Let us know what you think about these guidelines!
1 change: 1 addition & 0 deletions docs/blog/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Tags
52 changes: 51 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ extra:
- icon: fontawesome/brands/github
link: https://github.com/Gothic-Modding-Community/gmc
name: Gothic Modding Community GitHub repository
- icon: simple/rss
link: /gmc/feed_rss_updated.xml
name: Subscribe to our RSS Feed

validation:
nav:
Expand Down Expand Up @@ -127,6 +130,26 @@ plugins:
order: asc
sort_type: natural
order_by: title
- blog:
archive: false
categories_allowed: # Case-sensitive
# Primary level categories for the URLs
- Analysis # Posts about deep dives into certain topics.
- Community News # Posts about updates in the Gothic Modding Community.
- Devlogs # Posts about stories from mod development.
- Off-Topic # Posts about topics that don't fit other categories, e.g., WebDev.
- Showcase # Posts about tools, workflows etc.
- Tutorials # Posts including guides or follow-along tutorials.
# Secondary level categories for better granularity.
- Assets # Posts about 2D, 3D, Sound or other non-code file assets.
- Genome # Posts about Genome engine.
- Scripts # Posts about internal built-in scripting like Daedalus.
- SDK # Posts about external development kits like Union.
- Tools # Posts about tools.
- Workflows # Posts about workflows.
- ZenGin # Posts about ZenGin engine.
post_excerpt_max_categories: 3 # Default 5
post_url_format: "{categories}/{slug}" # Default {date}/{slug}
- mkdocs-video:
css_style:
width: "100%"
Expand All @@ -153,6 +176,7 @@ plugins:
nav_translations:
Afsp: AFSP
Anims: Animations
Blog: Community Posts
Contribute: How To Contribute
Daedalus tools: Daedalus
General info: General information
Expand All @@ -169,6 +193,7 @@ plugins:
nav_translations:
Anims: Animacje
Applications: Zastosowania
Blog: Posty Społeczności
Classes: Klasy
Contribute: Jak Się Udzielić
Examples: Przykłady
Expand Down Expand Up @@ -199,6 +224,7 @@ plugins:
- preferences*.md
- genome/index*.md
- zengin/index*.md
- blog/posts/**/*.md
- git-authors:
enabled: !ENV [GMC_ENABLE_ON_PUBLISH, False]
show_email_address: false
Expand All @@ -210,8 +236,32 @@ plugins:
- preferences*.md
- genome/index*.md
- zengin/index*.md
- blog/posts/**/*.md
- git-committers:
enabled: !ENV [GMC_ENABLE_ON_PUBLISH, False]
repository: Gothic-Modding-Community/gmc
branch: dev
exclude:
- index*.md
- preferences*.md
- genome/index*.md
- zengin/index*.md
- blog/posts/**/*.md
- redirects:
# Empty dict to fill with the `meta_redirects.py` hook.
redirect_maps: {}
- social:
enabled: !ENV [GMC_ENABLE_ON_PUBLISH, False]
enabled: !ENV [GMC_ENABLE_ON_PUBLISH, False]
- tags:
tags_file: blog/tags.md
- rss:
enabled: !ENV [GMC_ENABLE_ON_PUBLISH, False]
categories:
- tags
- categories
comments_path: "#comments" # Needs to be added manually to each file at the end
date_from_meta:
as_creation: date.created
as_update: date.updated
json_feed_enabled: false
match_path: "blog.posts..*" # regex, dots as dir separators to support Linux and Windows
Loading