[SiteGen] Add meta
This commit is contained in:
parent
758810cfe8
commit
cf61e63df0
|
@ -1,5 +1,4 @@
|
||||||
import { readFileSync, writeFileSync, copyFileSync } from "fs";
|
import { readFileSync, writeFileSync, copyFileSync } from "fs";
|
||||||
|
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
@ -55,19 +54,28 @@ export default () => {
|
||||||
|
|
||||||
let cards = [];
|
let cards = [];
|
||||||
|
|
||||||
|
let name = 'GooseMod Store';
|
||||||
|
let description = 'Browse GooseMod modules';
|
||||||
|
|
||||||
for (const repo of repos) {
|
for (const repo of repos) {
|
||||||
const repoName = repo.split('/').pop().split('.')[0];
|
console.log(repo);
|
||||||
console.log(repo, repoName);
|
|
||||||
|
|
||||||
const json = JSON.parse(readFileSync(repo, 'utf8'));
|
const json = JSON.parse(readFileSync(repo, 'utf8'));
|
||||||
console.log(json);
|
|
||||||
|
if (repos.length === 1) { // 1 repo likely means a custom repo, so use that name and description
|
||||||
|
name = json.meta.name;
|
||||||
|
description = json.meta.description;
|
||||||
|
}
|
||||||
|
|
||||||
cards = cards.concat(json.modules);
|
cards = cards.concat(json.modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
cards = cards.sort((a, b) => a.name.localeCompare(b.name)).map((x) => makeCard(x));
|
cards = cards.sort((a, b) => a.name.localeCompare(b.name)).map((x) => makeCard(x));
|
||||||
|
|
||||||
template = template.replace('ALL_CARDS', cards.join('\n'));
|
template = template
|
||||||
|
.replace('ALL_CARDS', cards.join('\n'))
|
||||||
|
.replaceAll('NAME', name)
|
||||||
|
.replaceAll('DESCRIPTION', description);
|
||||||
|
|
||||||
writeFileSync(join(global.distDir, 'index.html'), template);
|
writeFileSync(join(global.distDir, 'index.html'), template);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>GooseMod Store</title>
|
<title>NAME</title>
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
|
||||||
|
<meta itemprop="name" content="NAME">
|
||||||
|
<meta itemprop="description" content="DESCRIPTION">
|
||||||
|
|
||||||
|
<meta property="og:title" content="NAME">
|
||||||
|
<meta property="og:description" content="DESCRIPTION">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:url" content="/">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--elevation-medium: 0 4px 4px rgba(0,0,0,0.16);
|
--elevation-medium: 0 4px 4px rgba(0,0,0,0.16);
|
||||||
|
|
Loading…
Reference in New Issue