diff --git a/.gitignore b/.gitignore index d4b4d6cb3..44fd61e35 100644 --- a/.gitignore +++ b/.gitignore @@ -49,8 +49,8 @@ logs/ # for website website/node_modules/ website/src/blog/ +website/src/docs/ website/translations.json -website/src/_data/supported_languages.json website/src/img/images/ website/src/images/ # Generated files diff --git a/docs/ANDROID.md b/docs/ANDROID.md index 2b86ea9c3..55e6ef976 100644 --- a/docs/ANDROID.md +++ b/docs/ANDROID.md @@ -1,3 +1,8 @@ +--- +title: Accessing files in Android app +revision: 07.02.2023 +--- + | 07.02.2023 | EN, [CZ](/docs/lang/cs/ANDROID.md), [FR](/docs/lang/fr/ANDROID.md) | # Accessing files in Android app diff --git a/docs/CLI.md b/docs/CLI.md index 52a5f0147..65de29e60 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -1,3 +1,8 @@ +--- +title: Terminal CLI +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/CLI.md), [CZ](/docs/lang/cs/CLI.md) | # SimpleX Chat terminal (console) app for Linux/MacOS/Windows diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 2694396b6..ef58bfec0 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,3 +1,8 @@ +--- +title: Contributing guide +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/CONTRIBUTING.md), [CZ](/docs/lang/cs/CONTRIBUTING.md) | # Contributing guide diff --git a/docs/SERVER.md b/docs/SERVER.md index 5c53e9add..07594ca10 100644 --- a/docs/SERVER.md +++ b/docs/SERVER.md @@ -1,3 +1,8 @@ +--- +title: Hosting your own SMP Server +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/SERVER.md), [CZ](/docs/lang/cs/SERVER.md) | # Hosting your own SMP Server diff --git a/docs/SIMPLEX.md b/docs/SIMPLEX.md index c00adafd2..7ed01efa3 100644 --- a/docs/SIMPLEX.md +++ b/docs/SIMPLEX.md @@ -1,3 +1,8 @@ +--- +title: SimpleX platform +revision: 07.02.2023 +--- + | Updated 07.02.2023 | Languages: EN, [FR](/docs/lang/fr/SIMPLEX.md), [CZ](/docs/lang/cs/SIMPLEX.md) | # SimpleX platform - motivation and comparison diff --git a/docs/SQL.md b/docs/SQL.md index d320e3604..d5b469050 100644 --- a/docs/SQL.md +++ b/docs/SQL.md @@ -1,3 +1,8 @@ +--- +title: Accessing messages in the database +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/SQL.md), [CZ](/docs/lang/cs/SQL.md) | # Accessing messages in the database diff --git a/docs/TRANSLATIONS.md b/docs/TRANSLATIONS.md index e23161038..bb8764b14 100644 --- a/docs/TRANSLATIONS.md +++ b/docs/TRANSLATIONS.md @@ -1,3 +1,8 @@ +--- +title: Contributing translations to SimpleX Chat +revision: 19.03.2023 +--- + | 19.03.2023 | EN, [CZ](/docs/lang/cs/TRANSLATIONS.md), [FR](/docs/lang/fr/TRANSLATIONS.md) | # Contributing translations to SimpleX Chat diff --git a/docs/WEBRTC.md b/docs/WEBRTC.md index 850a28834..304f29d81 100644 --- a/docs/WEBRTC.md +++ b/docs/WEBRTC.md @@ -1,3 +1,8 @@ +--- +title: Using custom WebRTC ICE servers in SimpleX Chat +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/WEBRTC.md), [CZ](/docs/lang/cs/WEBRTC.md) | # Using custom WebRTC ICE servers in SimpleX Chat diff --git a/docs/XFTP-SERVER.md b/docs/XFTP-SERVER.md index 1359616ed..567ae63b0 100644 --- a/docs/XFTP-SERVER.md +++ b/docs/XFTP-SERVER.md @@ -1,3 +1,7 @@ +--- +title: Hosting your own XFTP Server +revision: 21.04.2023 +--- # Hosting your own XFTP Server ## Overview diff --git a/docs/guide/README.md b/docs/guide/README.md index 7836b0b40..04e753896 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,3 +1,6 @@ +--- +title: Quick start +--- # SimpleX Chat User Guide The first messaging platform that has no user identifiers of any kind — 100% private by design. diff --git a/docs/guide/app-settings.md b/docs/guide/app-settings.md index 90adf335b..26817a20f 100644 --- a/docs/guide/app-settings.md +++ b/docs/guide/app-settings.md @@ -1,3 +1,6 @@ +--- +title: App settings +--- # App settings ## Opening the app settings diff --git a/docs/guide/audio-video-calls.md b/docs/guide/audio-video-calls.md index 23101d2d6..8fc2bf95b 100644 --- a/docs/guide/audio-video-calls.md +++ b/docs/guide/audio-video-calls.md @@ -1,3 +1,6 @@ +--- +title: Audio & video Calls +--- # Audio and Video Calls SimpleX Chat allows you to make end-to-end encrypted audio and video calls with your contacts via WebRTC. Note: Group calls are not supported at this time. diff --git a/docs/guide/chat-profiles.md b/docs/guide/chat-profiles.md index 9cede5b8c..d20790037 100644 --- a/docs/guide/chat-profiles.md +++ b/docs/guide/chat-profiles.md @@ -1,3 +1,6 @@ +--- +title: Chat profiles +--- # Your chat profiles ## Creating additional chat profiles diff --git a/docs/guide/making-connections.md b/docs/guide/making-connections.md index 55465f1f6..0cf46aecd 100644 --- a/docs/guide/making-connections.md +++ b/docs/guide/making-connections.md @@ -1,3 +1,6 @@ +--- +title: Making connections +--- # Connect to somebody in the chat _Work in progress_ diff --git a/docs/guide/managing-data.md b/docs/guide/managing-data.md index 3324189cf..c52482574 100644 --- a/docs/guide/managing-data.md +++ b/docs/guide/managing-data.md @@ -1,3 +1,6 @@ +--- +title: Managing data +--- # Managing Your Data ## Automatic message deletion diff --git a/docs/guide/privacy-security.md b/docs/guide/privacy-security.md index 43ece140a..849a17f65 100644 --- a/docs/guide/privacy-security.md +++ b/docs/guide/privacy-security.md @@ -1,3 +1,6 @@ +--- +title: Privacy & security +--- # Privacy and Security SimpleX Chat default configuration aims to balance privacy, security and convenience. You may want to change the default options. diff --git a/docs/guide/secret-groups.md b/docs/guide/secret-groups.md index 9ecdc7e4c..5cdbcf86d 100644 --- a/docs/guide/secret-groups.md +++ b/docs/guide/secret-groups.md @@ -1,3 +1,6 @@ +--- +title: Secret groups +--- # Secret groups Secret groups are anonymous and private, they are designed to be hard to track by outsiders. Every message and file gets sent separately to every member in the group, which makes secret groups only fit for smaller groups. diff --git a/docs/guide/send-messages.md b/docs/guide/send-messages.md index 9762e86f4..8292bd574 100644 --- a/docs/guide/send-messages.md +++ b/docs/guide/send-messages.md @@ -1,3 +1,6 @@ +--- +title: Sending messages +--- # Sending, editing and deleting messages Sending text messages on SimpleX Chat is pretty straightforward, tap on your contact and then tap on text area, type in your message and tap on "Send" button. diff --git a/docs/lang/cs/ANDROID.md b/docs/lang/cs/ANDROID.md index c0fb859ca..38dd105bb 100644 --- a/docs/lang/cs/ANDROID.md +++ b/docs/lang/cs/ANDROID.md @@ -1,3 +1,7 @@ +--- +title: Přístup k souborům v aplikaci Android +revision: 07.02.2023 +--- | Aktualizováno 07.02.2023 | Jazyky: CZ, [EN](/docs/ANDROID.md) | # Přístup k souborům v aplikaci Android diff --git a/docs/lang/cs/CLI.md b/docs/lang/cs/CLI.md index f6b9dbe0e..731e23666 100644 --- a/docs/lang/cs/CLI.md +++ b/docs/lang/cs/CLI.md @@ -1,3 +1,7 @@ +--- +title: SimpleX Chat terminálová +revision: 31.01.2023 +--- | Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/CLI.md), [FR](/docs/lang/fr/CLI.md) | # SimpleX Chat terminálová (konzolová) aplikace pro Linux/MacOS/Windows @@ -174,7 +178,7 @@ Po spuštění chatu budete vyzváni k zadání svého "zobrazovacího jména" a Následující schéma ukazuje, jak se připojit ke kontaktu a poslat mu zprávu:
+
diff --git a/docs/lang/cs/SIMPLEX.md b/docs/lang/cs/SIMPLEX.md
index 2727d2b9d..33d45cec6 100644
--- a/docs/lang/cs/SIMPLEX.md
+++ b/docs/lang/cs/SIMPLEX.md
@@ -1,3 +1,7 @@
+---
+title: Platforma SimpleX
+revision: 07.02.2023
+---
| Aktualizováno 07.02.2023 | Jazyky: CZ, [EN](/docs/SIMPLEX.md), [FR](/docs/lang/fr/SIMPLEX.md) |
# Platforma SimpleX - motivace a srovnání
diff --git a/docs/lang/cs/SQL.md b/docs/lang/cs/SQL.md
index d9ea8f236..71ef0007c 100644
--- a/docs/lang/cs/SQL.md
+++ b/docs/lang/cs/SQL.md
@@ -1,3 +1,7 @@
+---
+title: Přístup ke zprávám v databázi
+revision: 31.01.2023
+---
| Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/SQL.md), [FR](/docs/lang/fr/SQL.md) |
# Přístup ke zprávám v databázi
diff --git a/docs/lang/cs/TRANSLATIONS.md b/docs/lang/cs/TRANSLATIONS.md
index 0cdd13a2b..b260bd12a 100644
--- a/docs/lang/cs/TRANSLATIONS.md
+++ b/docs/lang/cs/TRANSLATIONS.md
@@ -1,3 +1,7 @@
+---
+title: Přispívání překladů do SimpleX Chat
+revision: 07.02.2023
+---
| Aktualizováno 07.02.2023 | Jazyky: CZ, [EN](/docs/TRANSLATIONS.md) |
# Přispívání překladů do SimpleX Chat
@@ -22,7 +26,7 @@ Tento dokument vznikl proto, abychom tento proces urychlili, a podělili se s v
2. Některé řetězce není třeba překládat, ale přesto je třeba je překopírovat - v uživatelském rozhraní Weblate je k tomu tlačítko:
-
+
3. Weblate má také automatické návrhy, které mohou proces urychlit. Někdy je lze použít tak, jak jsou, jindy je třeba je upravit - kliknutím je použijete v překladu.
@@ -30,7 +34,7 @@ Tento dokument vznikl proto, abychom tento proces urychlili, a podělili se s v
5. Při překladu [aplikace pro iOS](https://hosted.weblate.org/projects/simplex-chat/ios/) je velká část řetězců naprosto stejná - lze je jedním kliknutím překopírovat do sekce glosář. Vizuální nápovědou, že to lze provést, je to, že celý zdrojový řetězec je zvýrazněn žlutě. Mnoho dalších řetězců je velmi podobných, liší se pouze syntaxí interpolace nebo způsobem použití tučného písma - vyžadují minimální úpravy. Existují některé řetězce, které jsou jedinečné pro platformu iOS - ty je třeba přeložit zvlášť.
-
+
## Po dokončení překladu
diff --git a/docs/lang/cs/WEBRTC.md b/docs/lang/cs/WEBRTC.md
index 3a9dc30a8..64ebc9109 100644
--- a/docs/lang/cs/WEBRTC.md
+++ b/docs/lang/cs/WEBRTC.md
@@ -1,3 +1,7 @@
+---
+title: Použití vlastních serverů WebRTC ICE v SimpleX Chat
+revision: 31.01.2023
+---
| Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/WEBRTC.md), [FR](/docs/lang/fr/WEBRTC.md) |
# Použití vlastních serverů WebRTC ICE v SimpleX Chat
@@ -124,7 +128,7 @@ To je vše - nyní můžete uskutečňovat audio a video hovory prostřednictví
2. Do části **Sestavit seznam serverů ICE** přidejte:
-
.
+
.
- `STUN: stun:
+
4. V části **Výsledky** byste měli vidět něco takového:
-
+
Pokud výsledky zobrazují kandidáty `srflx` a `relay`, je vše nastaveno správně!
diff --git a/docs/lang/fr/ANDROID.md b/docs/lang/fr/ANDROID.md
index 6af2de5ee..905af5015 100644
--- a/docs/lang/fr/ANDROID.md
+++ b/docs/lang/fr/ANDROID.md
@@ -1,3 +1,7 @@
+---
+title: Accès aux fichiers dans l'application Android
+revision: 07.02.2023
+---
| 07.02.2023 | FR, [EN](/docs/ANDROID.md), [CZ](/docs/lang/cs/ANDROID.md) |
# Accès aux fichiers dans l'application Android
diff --git a/docs/lang/fr/CLI.md b/docs/lang/fr/CLI.md
index 289e9d972..2c4a88e2d 100644
--- a/docs/lang/fr/CLI.md
+++ b/docs/lang/fr/CLI.md
@@ -1,3 +1,7 @@
+---
+title: Application de terminal
+revision: 31.01.2023
+---
| 31.01.2023 | FR, [EN](/docs/CLI.md), [CZ](/docs/lang/cs/CLI.md) |
# Application de terminal (console) SimpleX Chat pour Linux/MacOS/Windows
diff --git a/docs/lang/fr/CONTRIBUTING.md b/docs/lang/fr/CONTRIBUTING.md
index c9965e024..81515b09b 100644
--- a/docs/lang/fr/CONTRIBUTING.md
+++ b/docs/lang/fr/CONTRIBUTING.md
@@ -1,3 +1,7 @@
+---
+title: Guide pour contribuer
+revision: 31.01.2023
+---
| 31.01.2023 | FR, [EN](/docs/CONTRIBUTING.md), [CZ](/docs/lang/cs/CONTRIBUTING.md) |
# Guide pour contribuer
diff --git a/docs/lang/fr/SERVER.md b/docs/lang/fr/SERVER.md
index 7bbffd772..6f9c7c599 100644
--- a/docs/lang/fr/SERVER.md
+++ b/docs/lang/fr/SERVER.md
@@ -1,3 +1,7 @@
+---
+title: Héberger votre propre serveur SMP
+revision: 31.01.2023
+---
| 31.01.2023 | FR, [EN](/docs/SERVER.md), [CZ](/docs/lang/cs/SERVER.md) |
# Héberger votre propre serveur SMP
diff --git a/docs/lang/fr/SIMPLEX.md b/docs/lang/fr/SIMPLEX.md
index 10c55ee05..a7134205d 100644
--- a/docs/lang/fr/SIMPLEX.md
+++ b/docs/lang/fr/SIMPLEX.md
@@ -1,3 +1,7 @@
+---
+title: Plateforme SimpleX
+revision: 07.02.2023
+---
| 07.02.2023 | FR, [EN](/docs/SIMPLEX.md), [CZ](/docs/lang/cs/SIMPLEX.md) |
# Plateforme SimpleX - motivation et comparaison
diff --git a/docs/lang/fr/SQL.md b/docs/lang/fr/SQL.md
index d1f19abd5..d141153d6 100644
--- a/docs/lang/fr/SQL.md
+++ b/docs/lang/fr/SQL.md
@@ -1,3 +1,7 @@
+---
+title: Accès aux messages de la base de données
+revision: 31.01.2023
+---
| 31.01.2023 | FR, [EN](/docs/SQL.md), [CZ](/docs/lang/cs/SQL.md) |
# Accès aux messages de la base de données
diff --git a/docs/lang/fr/TRANSLATIONS.md b/docs/lang/fr/TRANSLATIONS.md
index 7eb7969da..e85a4a851 100644
--- a/docs/lang/fr/TRANSLATIONS.md
+++ b/docs/lang/fr/TRANSLATIONS.md
@@ -1,3 +1,7 @@
+---
+title: Contribuer aux traductions de SimpleX Chat
+revision: 19.03.2023
+---
| 19.03.2023 | FR, [EN](/docs/TRANSLATIONS.md), [CZ](/docs/lang/cs/TRANSLATIONS.md) |
# Contribuer aux traductions de SimpleX Chat
diff --git a/docs/lang/fr/WEBRTC.md b/docs/lang/fr/WEBRTC.md
index 48f529d6b..e06ca46c1 100644
--- a/docs/lang/fr/WEBRTC.md
+++ b/docs/lang/fr/WEBRTC.md
@@ -1,3 +1,7 @@
+---
+title: Utilisation de serveurs WebRTC ICE personnalisés dans SimpleX Chat
+revision: 31.01.2023
+---
| 31.01.2023 | FR, [EN](/docs/WEBRTC.md), [CZ](/docs/lang/cs/WEBRTC.md) |
# Utilisation de serveurs WebRTC ICE personnalisés dans SimpleX Chat
diff --git a/docs/protocol/simplex-chat.md b/docs/protocol/simplex-chat.md
index 0dd61d292..95069c794 100644
--- a/docs/protocol/simplex-chat.md
+++ b/docs/protocol/simplex-chat.md
@@ -1,3 +1,7 @@
+---
+title: SimpleX Chat Protocol
+revision: 08.08.2022
+---
DRAFT Revision 0.1, 2022-08-08
Evgeny Poberezkin
diff --git a/website/.eleventy.js b/website/.eleventy.js
index 7dc872b6a..07815958e 100644
--- a/website/.eleventy.js
+++ b/website/.eleventy.js
@@ -15,7 +15,7 @@ const globalConfig = {
}
const translationsDirectoryPath = './langs'
-const supportedRoutes = ["blog", "contact", "invitation", ""]
+const supportedRoutes = ["blog", "contact", "invitation", "docs", ""]
let supportedLangs = []
fs.readdir(translationsDirectoryPath, (err, files) => {
if (err) {
@@ -26,7 +26,7 @@ fs.readdir(translationsDirectoryPath, (err, files) => {
return file.endsWith('.json') && fs.statSync(translationsDirectoryPath + '/' + file).isFile()
})
supportedLangs = jsonFileNames.map(file => file.replace('.json', ''))
-});
+})
const translations = require("./translations.json")
@@ -40,18 +40,41 @@ module.exports = function (ty) {
return "en"
})
- ty.addShortcode("getlangRoute", (path) => {
- const lang = path.split("/")[1]
- if (supportedRoutes.includes(lang)) return ""
- if (supportedLangs.includes(lang)) return `/${lang}`
- return "/en"
+ ty.addFilter("getlang", (path) => {
+ const urlParts = path.split("/")
+ if (urlParts[1] === "docs") {
+ if (urlParts[2] === "lang") {
+ return urlParts[3]
+ }
+ return "en"
+ }
+ else {
+ if (supportedRoutes.includes(urlParts[1])) return "en"
+ else if (supportedLangs.includes(urlParts[1])) return urlParts[1]
+ return "en"
+ }
})
ty.addShortcode("completeRoute", (obj) => {
const urlParts = obj.url.split("/")
+
if (supportedRoutes.includes(urlParts[1])) {
if (urlParts[1] == "blog")
return `/blog`
+
+ else if (urlParts[1] === "docs") {
+ if (urlParts[2] === "lang") {
+ if (obj.lang === "en")
+ return `/docs/${urlParts.slice(4).join('/')}`
+ return `/docs/lang/${obj.lang}/${urlParts.slice(4).join('/')}`
+ }
+ else {
+ if (obj.lang === "en")
+ return `${obj.url}`
+ return `/docs/lang/${obj.lang}/${urlParts.slice(2).join('/')}`
+ }
+ }
+
else if (obj.lang === "en")
return `${obj.url}`
return `/${obj.lang}${obj.url}`
@@ -73,7 +96,7 @@ module.exports = function (ty) {
'*': 'en'
},
defaultLocale: 'en',
- });
+ })
// Keeps the same directory structure.
ty.addPassthroughCopy("src/assets/")
@@ -87,7 +110,10 @@ module.exports = function (ty) {
ty.addPassthroughCopy("src/hero-phone")
ty.addPassthroughCopy("src/hero-phone-dark")
ty.addPassthroughCopy("src/blog/images")
- supportedLangs.forEach(lang => ty.addPassthroughCopy(`src/${lang}/blog/images`))
+ ty.addPassthroughCopy("src/docs/*.png")
+ ty.addPassthroughCopy("src/docs/images")
+ ty.addPassthroughCopy("src/docs/protocol/diagrams")
+ ty.addPassthroughCopy("src/docs/protocol/*.json")
ty.addPassthroughCopy("src/images")
ty.addPassthroughCopy("src/CNAME")
ty.addPassthroughCopy("src/.well-known")
@@ -96,6 +122,83 @@ module.exports = function (ty) {
return collection.getFilteredByGlob('src/blog/*.md').reverse()
})
+ ty.addCollection('docs', function (collection) {
+ const docs = collection.getFilteredByGlob('src/docs/**/*.md')
+ .map(doc => {
+ return { url: doc.url, title: doc.data.title, inputPath: doc.inputPath }
+ })
+
+ let referenceContent = fs.readFileSync(path.resolve(__dirname, 'src/_data/docs_sidebar.json'), 'utf-8')
+ referenceContent = JSON.parse(referenceContent).items
+
+ const newDocs = []
+
+ referenceContent.forEach(referenceMenu => {
+ referenceMenu.data.forEach(referenceSubmenu => {
+ docs.forEach(doc => {
+ const url = doc.url.replace("/docs/", "")
+ const urlParts = url.split("/")
+
+ if (doc.inputPath.includes(referenceSubmenu)) {
+ if (urlParts.length === 1 && urlParts[0] !== "") {
+ const index = newDocs.findIndex((ele) => ele.lang === 'en' && ele.menu === referenceMenu.menu)
+ if (index !== -1) {
+ newDocs[index].data.push(doc)
+ }
+ else {
+ newDocs.push({
+ lang: 'en',
+ menu: referenceMenu.menu,
+ data: [doc],
+ })
+ }
+ }
+ else if (urlParts.length > 1 && urlParts[0] !== "" && urlParts[0] !== "lang") {
+ const index = newDocs.findIndex((ele) => ele.lang === 'en' && ele.menu === referenceMenu.menu)
+ if (index !== -1) {
+ newDocs[index].data.push(doc)
+ } else {
+ newDocs.push({
+ lang: 'en',
+ menu: referenceMenu.menu,
+ data: [doc],
+ })
+ }
+ }
+ else if (urlParts.length === 3 && urlParts[0] === "lang" && urlParts[2] !== '') {
+ const index = newDocs.findIndex((ele) => ele.lang === urlParts[1] && ele.menu === referenceMenu.menu)
+ if (index !== -1) {
+ newDocs[index].data.push(doc)
+ }
+ else {
+ newDocs.push({
+ lang: urlParts[1],
+ menu: referenceMenu.menu,
+ data: [doc],
+ })
+ }
+ }
+ else if (urlParts.length > 3 && urlParts[0] === "lang" && urlParts[2] !== '') {
+ const index = newDocs.findIndex((ele) => ele.lang === urlParts[1] && ele.menu === referenceMenu.menu)
+ if (index !== -1) {
+ newDocs[index].data.push(doc)
+ }
+ else {
+ newDocs.push({
+ lang: urlParts[1],
+ menu: referenceMenu.menu,
+ data: [doc],
+ })
+ }
+ }
+ }
+ })
+ })
+ })
+
+ return newDocs
+ })
+
ty.addWatchTarget("src/css")
ty.addWatchTarget("markdown/")
ty.addWatchTarget("components/Card.js")
diff --git a/website/customize_docs_frontmatter.js b/website/customize_docs_frontmatter.js
new file mode 100644
index 000000000..8f2546e16
--- /dev/null
+++ b/website/customize_docs_frontmatter.js
@@ -0,0 +1,90 @@
+const fs = require('fs');
+const path = require('path');
+const matter = require('gray-matter');
+
+const directoryPath = path.resolve(__dirname, 'src/docs');
+const langFolder = 'lang';
+const enFiles = {};
+
+function traverseDirectory(directory, currentLanguage = 'en', result = {}, callback) {
+ const filesAndDirectories = fs.readdirSync(directory);
+
+ filesAndDirectories.forEach((fileOrDirectoryName) => {
+ const fullPath = path.join(directory, fileOrDirectoryName);
+
+ if (fs.statSync(fullPath).isDirectory()) {
+ // If the subdirectory is inside the 'lang' folder, update the current language
+ if (directory.endsWith('/lang')) {
+ currentLanguage = fileOrDirectoryName;
+ }
+
+ // Recursively traverse the subdirectories
+ traverseDirectory(fullPath, currentLanguage, result, callback);
+ } else {
+ // Process the file only if it has the '.md' extension
+ if (path.extname(fullPath) === '.md') {
+ // Add the language to the file's language array or create a new array if it doesn't exist
+ const fileName = path.basename(fullPath, '.md');
+ if (!result[fileName]) {
+ result[fileName] = [];
+ }
+ result[fileName].push(currentLanguage);
+ }
+ if (callback) {
+ callback(fullPath, currentLanguage);
+ }
+ }
+ });
+
+ return result;
+}
+
+const fileLanguageMapping = traverseDirectory(directoryPath);
+
+// Update the frontmatter of each Markdown file
+Object.entries(fileLanguageMapping).forEach(([fileName, languages]) => {
+ // Find and update the frontmatter of each Markdown file
+ traverseDirectory(directoryPath, null, {}, (fullPath, currentLanguage) => {
+ if (path.basename(fullPath) === `${fileName}.md`) {
+ // Read the existing frontmatter
+ const fileContent = fs.readFileSync(fullPath, 'utf-8');
+ const parsedMatter = matter(fileContent);
+ const relativePath = path.relative(directoryPath, fullPath);
+
+ // Calculate the permalink based on the file's location
+ const linkPath = path.relative(directoryPath, fullPath).replace(/\.md$/, '.html');
+ const permalink = `/docs/${linkPath}`.toLowerCase();
+ parsedMatter.data.permalink = permalink;
+
+ // Update the frontmatter with the new languages list
+ parsedMatter.data.supportedLangsForDoc = languages;
+
+ // Add the layout value
+ parsedMatter.data.layout = 'layouts/doc.html';
+
+ if (fullPath.startsWith(path.join(directoryPath, langFolder))) {
+ // Non-English files
+ const [language, ...rest] = relativePath.split(path.sep).slice(1);
+ const enFilePath = path.join(directoryPath, ...rest);
+
+ if (enFiles[enFilePath]) {
+ const enRevision = new Date(enFiles[enFilePath].revision);
+ const currentRevision = new Date(parsedMatter.data.revision);
+
+ const isOld = currentRevision < enRevision;
+ // Add the version value
+ parsedMatter.data.version = isOld ? 'old' : 'new';
+ }
+ } else {
+ // English files
+ enFiles[fullPath] = { revision: parsedMatter.data.revision };
+ // Add the version value
+ parsedMatter.data.version = 'new';
+ }
+
+ // Save the updated frontmatter and content back to the file
+ const updatedFileContent = matter.stringify(parsedMatter.content, parsedMatter.data);
+ fs.writeFileSync(fullPath, updatedFileContent, 'utf-8');
+ }
+ });
+});
diff --git a/website/langs/en.json b/website/langs/en.json
index 1a8b0baa8..7b0f35b1c 100644
--- a/website/langs/en.json
+++ b/website/langs/en.json
@@ -209,5 +209,27 @@
"comparison-section-list-point-5": "Does not protect users' metadata",
"comparison-section-list-point-6": "While P2P are distributed, they are not federated - they operate as a single network",
"comparison-section-list-point-7": "P2P networks either have a central authority or the whole network can be compromised",
- "see-here": "see here"
+ "see-here": "see here",
+ "guide-dropdown-1": "Quick start",
+ "guide-dropdown-2": "Sending messages",
+ "guide-dropdown-3": "Secret groups",
+ "guide-dropdown-4": "Chat profiles",
+ "guide-dropdown-5": "Managing data",
+ "guide-dropdown-6": "Audio & video Calls",
+ "guide-dropdown-7": "Privacy & security",
+ "guide-dropdown-8": "App settings",
+ "guide-dropdown-9": "Making connections",
+ "guide": "Guide",
+ "docs-dropdown-1": "SimpleX platform",
+ "docs-dropdown-2": "Accessing Android files",
+ "docs-dropdown-3": "Accessing chat database",
+ "docs-dropdown-4": "Host SMP Server",
+ "docs-dropdown-5": "Host XFTP Server",
+ "docs-dropdown-6": "WebRTC servers",
+ "docs-dropdown-7": "Translate SimpleX Chat",
+ "newer-version-of-eng-msg": "There is a newer version of this page in English.",
+ "click-to-see": "Click to see",
+ "menu": "Menu",
+ "on-this-page": "On this page",
+ "back-to-top": "Back to top"
}
\ No newline at end of file
diff --git a/website/merge_translations.js b/website/merge_translations.js
index 37de897de..163606d5e 100644
--- a/website/merge_translations.js
+++ b/website/merge_translations.js
@@ -9,11 +9,11 @@ const jsonFileNames = files.filter(file => file.endsWith('.json'));
supportedLangs = jsonFileNames.map(file => file.replace('.json', ''))
// keys of the english language are used as the base keys
-const enStrings = require("./langs/en.json")
+const enStrings = require(path.resolve(__dirname, "langs/en.json"))
const languages = {}
for (const lang of supportedLangs) {
- languages[lang] = require(`./langs/${lang}.json`)
+ languages[lang] = require(path.resolve(__dirname, `langs/${lang}.json`))
}
// this program generates a combined translations.json file
@@ -27,9 +27,7 @@ for (const key in enStrings) {
translations[key] = langStrings
}
-saveFile("translations.json", translations)
-// the list in the supported_languages.json file is used as the reference list for displaying available languages on the frontend
-saveFile("src/_data/supported_languages.json", {"langs": supportedLangs})
+saveFile(path.resolve(__dirname, "translations.json"), translations)
function saveFile(relPath, data) {
filePath = path.resolve(__dirname, relPath)
diff --git a/website/package.json b/website/package.json
index 5560e7bec..758e2f62a 100644
--- a/website/package.json
+++ b/website/package.json
@@ -28,6 +28,7 @@
"tailwindcss": "^3.2.7"
},
"dependencies": {
- "eleventy-plugin-i18n": "^0.1.3"
+ "eleventy-plugin-i18n": "^0.1.3",
+ "gray-matter": "^4.0.3"
}
}
diff --git a/website/src/_data/docs_dropdown.json b/website/src/_data/docs_dropdown.json
new file mode 100644
index 000000000..ff05242c8
--- /dev/null
+++ b/website/src/_data/docs_dropdown.json
@@ -0,0 +1,32 @@
+{
+ "items": [
+ {
+ "title": "docs-dropdown-1",
+ "url": "/docs/simplex.html"
+ },
+ {
+ "title": "docs-dropdown-2",
+ "url": "/docs/android.html"
+ },
+ {
+ "title": "docs-dropdown-3",
+ "url": "/docs/sql.html"
+ },
+ {
+ "title": "docs-dropdown-4",
+ "url": "/docs/server.html"
+ },
+ {
+ "title": "docs-dropdown-5",
+ "url": "/docs/xftp-server.html"
+ },
+ {
+ "title": "docs-dropdown-6",
+ "url": "/docs/webrtc.html"
+ },
+ {
+ "title": "docs-dropdown-7",
+ "url": "/docs/translations.html"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/website/src/_data/docs_sidebar.json b/website/src/_data/docs_sidebar.json
new file mode 100644
index 000000000..f05ae0ab1
--- /dev/null
+++ b/website/src/_data/docs_sidebar.json
@@ -0,0 +1,38 @@
+{
+ "items": [
+ {
+ "menu": "Guide",
+ "data": [
+ "README.md",
+ "send-messages.md",
+ "secret-groups.md",
+ "chat-profiles.md",
+ "managing-data.md",
+ "audio-video-calls.md",
+ "privacy-security.md",
+ "app-settings.md",
+ "making-connections.md"
+ ]
+ },
+ {
+ "menu": "Reference",
+ "data": [
+ "SIMPLEX.md",
+ "ANDROID.md",
+ "CLI.md",
+ "SQL.md",
+ "CONTRIBUTING.md",
+ "SERVER.md",
+ "TRANSLATIONS.md",
+ "WEBRTC.md",
+ "XFTP-SERVER.md"
+ ]
+ },
+ {
+ "menu": "Protocol",
+ "data": [
+ "simplex-chat.md"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/website/src/_data/guide_dropdown.json b/website/src/_data/guide_dropdown.json
new file mode 100644
index 000000000..fc6383c70
--- /dev/null
+++ b/website/src/_data/guide_dropdown.json
@@ -0,0 +1,40 @@
+{
+ "items": [
+ {
+ "title": "guide-dropdown-1",
+ "url": "/docs/guide/readme.html"
+ },
+ {
+ "title": "guide-dropdown-2",
+ "url": "/docs/guide/send-messages.html"
+ },
+ {
+ "title": "guide-dropdown-3",
+ "url": "/docs/guide/secret-groups.html"
+ },
+ {
+ "title": "guide-dropdown-4",
+ "url": "/docs/guide/chat-profiles.html"
+ },
+ {
+ "title": "guide-dropdown-5",
+ "url": "/docs/guide/managing-data.html"
+ },
+ {
+ "title": "guide-dropdown-6",
+ "url": "/docs/guide/audio-video-calls.html"
+ },
+ {
+ "title": "guide-dropdown-7",
+ "url": "/docs/guide/privacy-security.html"
+ },
+ {
+ "title": "guide-dropdown-8",
+ "url": "/docs/guide/app-settings.html"
+ },
+ {
+ "title": "guide-dropdown-9",
+ "url": "/docs/guide/making-connections.html"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/website/src/_includes/footer.html b/website/src/_includes/footer.html
index a3b984be3..42d8591fd 100644
--- a/website/src/_includes/footer.html
+++ b/website/src/_includes/footer.html
@@ -1,38 +1,51 @@
+{% set lang = page.url | getlang %}
-
+
+