Skip to content
Merged
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
66 changes: 64 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const markdownIt = require("markdown-it");
const fs = require("fs");
const nodePath = require("path");

function normalizePathPrefix(rawPathPrefix = "/") {
if (!rawPathPrefix || rawPathPrefix === "/") {
Expand All @@ -24,18 +26,71 @@ module.exports = function (eleventyConfig) {

eleventyConfig.addPassthroughCopy({ "assets/img": "img" });
eleventyConfig.addPassthroughCopy({ "assets/css": "css" });
eleventyConfig.addPassthroughCopy("CNAME");
eleventyConfig.addPassthroughCopy({ "assets/js": "js" });
eleventyConfig.addPassthroughCopy(".nojekyll");
eleventyConfig.addPassthroughCopy({ "assets/img/favicon.png": "favicon.png" });

eleventyConfig.addFilter("htmlDateString", (dateObj) => {
return new Date(dateObj).toISOString().split('T')[0];
});

eleventyConfig.addFilter("fileLastModified", function (inputPath, langCode) {
if (!inputPath) {
return null;
}

try {
const normalizedPath = String(inputPath).replace(/^\.\/+/, "");
const absolutePath = nodePath.resolve(process.cwd(), normalizedPath);
const stats = fs.statSync(absolutePath);
const locale = langCode === "uz" ? "uz-UZ" : "en-US";
return new Intl.DateTimeFormat(locale, {
year: "numeric",
month: "long",
day: "numeric"
}).format(stats.mtime);
} catch (_error) {
return null;
}
});

eleventyConfig.addFilter("urlencode", function (str) {
return encodeURIComponent(str);
});

eleventyConfig.addFilter("padStart", function (value, length, char) {
return String(value).padStart(length || 2, char || "0");
});

eleventyConfig.addFilter("displayTutorialTitle", function (value) {
if (typeof value !== "string") {
return value;
}

const original = value.trim();
if (!original) {
return value;
}

let title = original.replace(/\s+/g, " ");
const titleBeforeLeadingStrip = title;

// Remove common tutorial title wrappers that redundantly include "Python".
title = title.replace(/\s*\(\s*Python\s*\)\s*$/i, "");
title = title.replace(/\s+(?:to|in|with|for|on)\s+Python$/i, "");
title = title.replace(/\s+Python$/i, "");
title = title.replace(/^Python'(?:ga|ni|da|ning)\s+/i, "");
title = title.replace(/^Python(?:ga|ni|da|ning)\s+/i, "");
title = title.replace(/^Python\s+/i, "");

title = title.trim();
if (titleBeforeLeadingStrip !== title && /^[a-z]/.test(title)) {
title = title.charAt(0).toUpperCase() + title.slice(1);
}

return title || original;
});

eleventyConfig.addFilter("getTutorialNav", function (tutorials, currentUrl) {
if (!Array.isArray(tutorials) || !currentUrl) {
return { first: null, prev: null, next: null };
Expand All @@ -52,7 +107,13 @@ module.exports = function (eleventyConfig) {
});

eleventyConfig.addCollection("tutorials", function (collectionApi) {
return collectionApi.getFilteredByGlob("tutorial/**/*.md").sort((a, b) => {
return collectionApi.getFilteredByGlob("content/en/tutorial/**/*.md").sort((a, b) => {
return (a.data.order || 0) - (b.data.order || 0);
});
});

eleventyConfig.addCollection("tutorialsUz", function (collectionApi) {
return collectionApi.getFilteredByGlob("content/uz/tutorial/**/*.md").sort((a, b) => {
return (a.data.order || 0) - (b.data.order || 0);
});
});
Expand All @@ -62,6 +123,7 @@ module.exports = function (eleventyConfig) {
});

eleventyConfig.addWatchTarget("./assets/css/");
eleventyConfig.addWatchTarget("./assets/js/");
eleventyConfig.addWatchTarget("./tailwind.css");

eleventyConfig.setServerOptions({
Expand Down
2 changes: 2 additions & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ README.md
CONTRIBUTING.md
CODE_OF_CONDUCT.md
LICENSE
.github/**/*.md
docs/**/*.md
node_modules
_site
tailwind.css
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ Thank you for contributing.

- Keep tutorials clear, practical, and beginner-friendly.
- Use consistent front matter (`layout`, `title`, `order`, `permalink`).
- Place tutorials under `content/{en|uz}/tutorial/{basic|intermediate|advanced}/`.
- Use locale-first permalinks only:
- English tutorial: `/en/tutorial/{slug}/`
- Uzbek tutorial: `/uz/tutorial/{slug}/`
- Use `lang: en` or `lang: uz` in localized pages/tutorials.
- Wrap code-related prose tokens in inline code (for example: `if`, `else`, `for`, `while`, `True`, `False`, `None`, `{}`).
- Add descriptive image `alt` text.
- Verify internal links and JSON-LD output with `npm run check`.
- Keep localized repository docs under `docs/i18n/uz/` (these are not website pages).

## Pull Request Checklist

Expand Down
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

29 changes: 0 additions & 29 deletions CODE_OF_CONDUCT.md

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Belajarpython
Copyright (c) 2026 Valikhujaev Yakhyokhuja

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
44 changes: 28 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,56 @@

---

# [Belajarpython](https://www.belajarpython.com/) · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/belajarpythoncom/belajarpython.com/blob/main/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)
# [Belajarpython](https://www.belajarpython.com/) · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/codeuzhub/python-lessons/blob/main/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/codeuzhub/python-lessons/blob/main/.github/CONTRIBUTING.md)

Belajarpython adalah situs kolaboratif tutorial pemrograman Python bahasa Indonesia
Belajarpython is a collaborative platform for learning Python.

- **Ikuti Tutorial:** Mulai belajar bahasa pemrograman python dari tingkat dasar dengan tutorial yang dikhususkan untuk pemula agar lebih cepat mempelajari bahasa pemrograman python.
- **Baca Artikel:** Baca artikel terbaru dan terpopuler tentang bahasa pemrograman python dengan beragam topik. Artikel dibuat oleh komunitas dan ditujukan untuk komunitas.
- **Ajukan Pertanyaan:** Ajukan setiap pertanyaan yang anda temui tentang bahasa pemrograman python. Setiap orang di komunitas akan segera menyelesaikan setiap pertanyaan pengguna.
- **Follow Tutorials:** Start learning Python from the basics with beginner-focused tutorials designed to help you progress faster.
- **Read Articles:** Explore the latest and most popular Python articles across a wide range of topics. Content is created by the community for the community.
- **Ask Questions:** Ask any Python-related question you run into. Community members are ready to help you solve it.

## Kontribusi
## Contributing

Belajarpython adalah situs terbuka (open source) yang dikembangkan oleh developer untuk developer. Semua orang baik dari kalangan :trollface: developer, :man: mahasiswa, :older_woman: pengajar, bahkan :baby: anak kecil yang baru mempelajari bahasa pemrograman python bisa ikut memberikan :heart: kontribusinya [disini](./CONTRIBUTING.md)
Belajarpython is an open-source website built by developers for developers. Everyone is welcome to contribute: :trollface: developers, :man: students, :older_woman: educators, and even :baby: young beginners who are just learning Python can share their :heart: contributions [here](https://github.com/codeuzhub/python-lessons/blob/main/.github/CONTRIBUTING.md).

### [Code of Conduct](./CODE_OF_CONDUCT.md)
### [Contribution Guide](https://github.com/codeuzhub/python-lessons/blob/main/.github/CONTRIBUTING.md)

Belajarpython telah mengadopsi Kode Etik yang kami harapkan akan diikuti oleh peserta proyek terbuka ini. Mohon baca [full text](./CODE_OF_CONDUCT.md) sehingga anda dapat mengerti aksi apa yang yang bisa dan tidak bisa ditoleransi.

### [Panduan Kontribusi](./CONTRIBUTING.md)

Baca [panduan kontribusi](./CONTRIBUTING.md) dari kami untuk mempelajari tentang proses pengembangan konten disini.
Read our [contribution guide](https://github.com/codeuzhub/python-lessons/blob/main/.github/CONTRIBUTING.md) to learn about the content development workflow.

### Good First Issues

Untuk membantu Anda membuat kaki Anda basah dan membuat Anda terbiasa dengan proses kontribusi kami, kami memiliki daftar [good first issues](https://github.com/belajarpythoncom/belajarpython.com/issues) yang mengandung bug yang memiliki lingkup yang relatif terbatas. Ini adalah tempat yang bagus untuk memulai.
To help you get started and become familiar with our contribution process, we maintain a list of [good first issues](https://github.com/codeuzhub/python-lessons/issues) with relatively small scope. It is a great place to begin.

## Pengembangan Lokal
## Local Development

```bash
npm ci
npm run dev
```

Build produksi:
Production build:

```bash
npm run build
npm run check
```

## Content Structure

- English homepage: `content/en/index.md` (`/en/`)
- Uzbek homepage: `content/uz/index.md` (`/uz/`)
- English tutorials: `content/en/tutorial/{basic,intermediate,advanced}/*.md`
- Uzbek tutorials: `content/uz/tutorial/{basic,intermediate,advanced}/*.md`

Canonical tutorial URLs:

- English: `/en/tutorial/{slug}/`
- Uzbek: `/uz/tutorial/{slug}/`

Root `/` redirects to `/en/`.

Uzbek repository docs are stored in `docs/i18n/uz/` (repo-only, not website pages).

### License

Belajarpython is [MIT licensed](./LICENSE).
Loading
Loading