Add preview cards #2
2 changed files with 36 additions and 26 deletions
1
.prettierrc.toml
Normal file
1
.prettierrc.toml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
tabWidth = 4
|
61
src/index.js
61
src/index.js
|
@ -1,39 +1,48 @@
|
||||||
import express from 'express'
|
import express from "express";
|
||||||
import yaml from 'js-yaml'
|
import yaml from "js-yaml";
|
||||||
import fs from 'node:fs'
|
import fs from "node:fs";
|
||||||
import * as dotenv from 'dotenv'
|
import * as dotenv from "dotenv";
|
||||||
|
|
||||||
console.log('🔧 Configuring socialtree...')
|
console.log("🔧 Configuring socialtree...");
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config();
|
||||||
const app = express()
|
const app = express();
|
||||||
const port = process.env.PORT || 3000
|
const port = process.env.PORT || 3000;
|
||||||
const engine = 'ejs'
|
const engine = "ejs";
|
||||||
|
|
||||||
const customMainPartialThemes = [ // Array of themes that require a custom main partial
|
const customMainPartialThemes = [
|
||||||
'98'
|
// Array of themes that require a custom main partial
|
||||||
]
|
"98",
|
||||||
|
];
|
||||||
|
|
||||||
app.set('view engine', engine)
|
app.set("view engine", engine);
|
||||||
app.set('views', './src/views')
|
app.set("views", "./src/views");
|
||||||
app.use(express.static('src/dist'))
|
app.use(express.static("src/dist"));
|
||||||
app.use(express.static('assets'))
|
app.use(express.static("assets"));
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
let config = yaml.load(fs.readFileSync('assets/config/config.yml'), 'utf8')
|
let config = yaml.load(fs.readFileSync("assets/config/config.yml"), "utf8");
|
||||||
res.render('index', {
|
res.render("index", {
|
||||||
name: config.name,
|
name: config.name,
|
||||||
url: config.url,
|
url: config.url,
|
||||||
filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg',
|
filenameProfilePic: config.profilePic
|
||||||
summaryText: config.summaryText ? config.summaryText: '',
|
? config.profilePic
|
||||||
|
: "profilepic.jpg",
|
||||||
|
summaryText: config.summaryText ? config.summaryText : "",
|
||||||
links: config.links,
|
links: config.links,
|
||||||
smallLinks: config.smallLinks,
|
smallLinks: config.smallLinks,
|
||||||
theme: config.theme,
|
theme: config.theme,
|
||||||
roundPB: config.roundPB,
|
roundPB: config.roundPB,
|
||||||
customMainPartialThemes: customMainPartialThemes,
|
customMainPartialThemes: customMainPartialThemes,
|
||||||
metaDescription: config.summaryText ? config.summaryText: config.links.map(link => link.text).join(' | '),
|
metaDescription: config.summaryText
|
||||||
siteName: config.siteName ? config.siteName : "SocialTree"
|
? config.summaryText
|
||||||
})
|
: config.links.map((link) => link.text).join(" | "),
|
||||||
})
|
siteName: config.siteName ? config.siteName : "SocialTree",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.listen(port, () => console.log(`🚀 Socialtree started on port ${port}, with view engine ${engine}`))
|
app.listen(port, () =>
|
||||||
|
console.log(
|
||||||
|
`🚀 Socialtree started on port ${port}, with view engine ${engine}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue