From 2edf2710842b845b05b621a40111532599aab8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Fri, 14 Jul 2023 12:37:16 +0100 Subject: [PATCH] clean up users --- exampleSite/config/_default/config.toml | 2 +- exampleSite/content/users/tempusers.txt | 59 ------ exampleSite/content/users/users.json | 267 +++++++++++++++++++++++- processUsers.js | 44 ++-- 4 files changed, 286 insertions(+), 86 deletions(-) delete mode 100644 exampleSite/content/users/tempusers.txt diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml index 2046ac89..a02c2f9e 100644 --- a/exampleSite/config/_default/config.toml +++ b/exampleSite/config/_default/config.toml @@ -9,7 +9,7 @@ defaultContentLanguage = "en" # pluralizeListTitles = "true" # hugo function useful for non-english languages, find out more in https://gohugo.io/getting-started/configuration/#pluralizelisttitles enableRobotsTXT = true -paginate = 20 +paginate = 100 summaryLength = 30 buildDrafts = false diff --git a/exampleSite/content/users/tempusers.txt b/exampleSite/content/users/tempusers.txt deleted file mode 100644 index 28f25d47..00000000 --- a/exampleSite/content/users/tempusers.txt +++ /dev/null @@ -1,59 +0,0 @@ -| Website | Details | -| --------------------------------------------------------------------- | ---------------------------- | -| [nunocoracao.com](https://nunocoracao.com) | Personal site - Theme author | -| [madoke.org](https://madoke.org/) | Personal site | -| [code-chimp.com](https://code-chimp.com) | Personal site | -| [mucahitkurtlar.github.io](https://mucahitkurtlar.github.io) | Personal site | -| [brendanwallace.github.io](https://brendanwallace.github.io) | Personal site | -| [fedeizzo.dev](https://fedeizzo.dev) | Personal site | -| [cuttontail.blog](https://cuttontail.blog) | Personal site | -| [pmnxis.github.io](https://pmnxis.github.io) | Personal site | -| [ciicadalab.github.io](https://ciicadalab.github.io) | Organization site | -| [georgiancodeclub.github.io](https://georgiancodeclub.github.io) | College club site | -| [albertolvera.com](https://albertolvera.com) | Personal site | -| [chris.banes.dev](https://chris.banes.dev) | Personal site | -| [fahru.my.id](https://www.fahru.my.id) | Personal site | -| [jeknom.github.io](https://jeknom.github.io) | Personal site | -| [blog.watchstep.me](https://blog.watchstep.me) | Personal site | -| [overdevelop.io](https://overdevelop.io) | Personal site | -| [loisvelasco.is-a.dev](https://loisvelasco.is-a.dev) | Personal site | -| [tabletopflore.com](https://www.tabletopflore.com) | Personal site | -| [omarohn.de](https://omarohn.de) | Personal site | -| [spelucin.me](https://spelucin.me) | Personal site | -| [insidemordecai.com](https://insidemordecai.com) | Personal site | -| [jamesdixon.dev](https://jamesdixon.dev) | Personal site | -| [blastomussa.dev](https://blastomussa.dev) | Personal site | -| [cdell.io](https://cdell.io) | Personal site | -| [jam.dsg.li](https://jam.dsg.li) | Organization site | -| [priyakdey.com](https://priyakdey.com) | Personal site | -| [sdehm.dev](https://sdehm.dev) | Personal site | -| [dizzytech.de](https://dizzytech.de) | Personal site | -| [alejandro-ao.com](https://alejandro-ao.com/) | Personal site | -| [adir1.com](https://adir1.com/) | Personal site | -| [niklas-hartmann-dev.de](https://niklas-hartmann-dev.de/) | Personal site | -| [blog.muffn.io](https://blog.muffn.io/) | Personal site | -| [nick.bouwhuis.net](https://nick.bouwhuis.net) | Personal site | -| [vividscc.com](https://vividscc.com/) | Business site | -| [muhalvin.github.io](https://muhalvin.github.io/) | Personal site | -| [mariuskimmina.com](https://mariuskimmina.com/) | Personal site | -| [ashwinbalaji.xyz](https://ashwinbalaji.xyz/) | Personal site | -| [technicat.com](https://technicat.com/) | Company site | -| [fugugames.com](https://fugugames.com/) | Games site | -| [hyperbowl3d.com](https://hyperbowl3d.com/) | Game site | -| [talkdimsum.com](https://talkdimsum.com/) | App site | -| [alanctanner.com](https://alanctanner.com/) | Personal site | -| [rdgo.dev](https://rdgo.dev/) | Personal site | -| [ripplesding.github.io](https://ripplesding.github.io/) | Personal site | -| [terraformbuch.de](https://terraformbuch.de/) | Book site | -| [shenshu.fun](https://shenshu.fun/) | Personal site | -| [hellstabber.github.io](https://hellstabber.github.io/) | Personal site | -| [clemsau.com](https://clemsau.com/) | Personal site | -| [lelouvincx.github.io](https://lelouvincx.github.io/) | Personal site | -| [weaxsey.org](https://weaxsey.org/) | Personal site | -| [nikarashihatsu.github.io](https://nikarashihatsu.github.io/) | Personal site | -| [blog.enmanuelmoreira.com](https://blog.enmanuelmoreira.com) | Personal site | -| [halcyonstraits.com](https://www.halcyonstraits.com/) | Doll photography | -| [50-nuances-octets.fr](https://www.50-nuances-octets.fr/) | Organization site | -| [marupanda.art/marucomics](https://marupanda.art/marucomics/) | Comics site | -| [seanomahoney.com](https://seanomahoney.com/) | Personal site | -| [pacochan.net](https://pacochan.net) | Personal site | \ No newline at end of file diff --git a/exampleSite/content/users/users.json b/exampleSite/content/users/users.json index c5da779e..f6825259 100644 --- a/exampleSite/content/users/users.json +++ b/exampleSite/content/users/users.json @@ -13,5 +13,270 @@ "tags": [ "Personal site" ] - } + }, + { + "title": "code-chimp.com", + "url": "https://code-chimp.com", + "tags": ["Personal site"] + }, + { + "title": "mucahitkurtlar.github.io", + "url": "https://mucahitkurtlar.github.io", + "tags": ["Personal site"] + }, + { + "title": "brendanwallace.github.io", + "url": "https://brendanwallace.github.io", + "tags": ["Personal site"] + }, + { + "title": "fedeizzo.dev", + "url": "https://fedeizzo.dev", + "tags": ["Personal site"] + }, + { + "title": "cuttontail.blog", + "url": "https://cuttontail.blog", + "tags": ["Personal site"] + }, + { + "title": "pmnxis.github.io", + "url": "https://pmnxis.github.io", + "tags": ["Personal site"] + }, + { + "title": "ciicadalab.github.io", + "url": "https://ciicadalab.github.io", + "tags": ["Organization site"] + }, + { + "title": "georgiancodeclub.github.io", + "url": "https://georgiancodeclub.github.io", + "tags": ["College club site"] + }, + { + "title": "albertolvera.com", + "url": "https://albertolvera.com", + "tags": ["Personal site"] + }, + { + "title": "chris.banes.dev", + "url": "https://chris.banes.dev", + "tags": ["Personal site"] + }, + { + "title": "fahru.my.id", + "url": "https://www.fahru.my.id", + "tags": ["Personal site"] + }, + { + "title": "jeknom.github.io", + "url": "https://jeknom.github.io", + "tags": ["Personal site"] + }, + { + "title": "blog.watchstep.me", + "url": "https://blog.watchstep.me", + "tags": ["Personal site"] + }, + { + "title": "overdevelop.io", + "url": "https://overdevelop.io", + "tags": ["Personal site"] + }, + { + "title": "loisvelasco.is-a.dev", + "url": "https://loisvelasco.is-a.dev", + "tags": ["Personal site"] + }, + { + "title": "tabletopflore.com", + "url": "https://www.tabletopflore.com", + "tags": ["Personal site"] + }, + { + "title": "omarohn.de", + "url": "https://omarohn.de", + "tags": ["Personal site"] + }, + { + "title": "spelucin.me", + "url": "https://spelucin.me", + "tags": ["Personal site"] + }, + { + "title": "insidemordecai.com", + "url": "https://insidemordecai.com", + "tags": ["Personal site"] + }, + { + "title": "jamesdixon.dev", + "url": "https://jamesdixon.dev", + "tags": ["Personal site"] + }, + { + "title": "blastomussa.dev", + "url": "https://blastomussa.dev", + "tags": ["Personal site"] + }, + { + "title": "cdell.io", + "url": "https://cdell.io", + "tags": ["Personal site"] + }, + { + "title": "jam.dsg.li", + "url": "https://jam.dsg.li", + "tags": ["Organization site"] + }, + { + "title": "priyakdey.com", + "url": "https://priyakdey.com", + "tags": ["Personal site"] + }, + { + "title": "sdehm.dev", + "url": "https://sdehm.dev", + "tags": ["Personal site"] + }, + { + "title": "dizzytech.de", + "url": "https://dizzytech.de", + "tags": ["Personal site"] + }, + { + "title": "alejandro-ao.com", + "url": "https://alejandro-ao.com/", + "tags": ["Personal site"] + }, + { + "title": "adir1.com", + "url": "https://adir1.com/", + "tags": ["Personal site"] + }, + { + "title": "niklas-hartmann-dev.de", + "url": "https://niklas-hartmann-dev.de/", + "tags": ["Personal site"] + }, + { + "title": "blog.muffn.io", + "url": "https://blog.muffn.io/", + "tags": ["Personal site"] + }, + { + "title": "nick.bouwhuis.net", + "url": "https://nick.bouwhuis.net", + "tags": ["Personal site"] + }, + { + "title": "vividscc.com", + "url": "https://vividscc.com/", + "tags": ["Business site"] + }, + { + "title": "muhalvin.github.io", + "url": "https://muhalvin.github.io/", + "tags": ["Personal site"] + }, + { + "title": "mariuskimmina.com", + "url": "https://mariuskimmina.com/", + "tags": ["Personal site"] + }, + { + "title": "technicat.com", + "url": "https://technicat.com/", + "tags": ["Company site"] + }, + { + "title": "fugugames.com", + "url": "https://fugugames.com/", + "tags": ["Games site"] + }, + { + "title": "hyperbowl3d.com", + "url": "https://hyperbowl3d.com/", + "tags": ["Game site"] + }, + { + "title": "talkdimsum.com", + "url": "https://talkdimsum.com/", + "tags": ["App site"] + }, + { + "title": "alanctanner.com", + "url": "https://alanctanner.com/", + "tags": ["Personal site"] + }, + { + "title": "rdgo.dev", + "url": "https://rdgo.dev/", + "tags": ["Personal site"] + }, + { + "title": "terraformbuch.de", + "url": "https://terraformbuch.de/", + "tags": ["Book site"] + }, + { + "title": "shenshu.fun", + "url": "https://shenshu.fun/", + "tags": ["Personal site"] + }, + { + "title": "hellstabber.github.io", + "url": "https://hellstabber.github.io/", + "tags": ["Personal site"] + }, + { + "title": "clemsau.com", + "url": "https://clemsau.com/", + "tags": ["Personal site"] + }, + { + "title": "lelouvincx.github.io", + "url": "https://lelouvincx.github.io/", + "tags": ["Personal site"] + }, + { + "title": "weaxsey.org", + "url": "https://weaxsey.org/", + "tags": ["Personal site"] + }, + { + "title": "nikarashihatsu.github.io", + "url": "https://nikarashihatsu.github.io/", + "tags": ["Personal site"] + }, + { + "title": "blog.enmanuelmoreira.com", + "url": "https://blog.enmanuelmoreira.com", + "tags": ["Personal site"] + }, + { + "title": "halcyonstraits.com", + "url": "https://www.halcyonstraits.com/", + "tags": ["Doll photography"] + }, + { + "title": "50-nuances-octets.fr", + "url": "https://www.50-nuances-octets.fr/", + "tags": ["Organization site"] + }, + { + "title": "marupanda.art/marucomics", + "url": "https://marupanda.art/marucomics/", + "tags": ["Comics site"] + }, + { + "title": "seanomahoney.com", + "url": "https://seanomahoney.com/", + "tags": ["Personal site"] + }, + { + "title": "pacochan.net", + "url": "https://pacochan.net", + "tags": ["Personal site"] + } ] \ No newline at end of file diff --git a/processUsers.js b/processUsers.js index 2d1061f1..4aebbdb4 100644 --- a/processUsers.js +++ b/processUsers.js @@ -5,18 +5,28 @@ const usersFolderPath = "./exampleSite/content/users/" let rawdata = fs.readFileSync(usersFolderPath + 'users.json'); let users = JSON.parse(rawdata); +let userDict = {} +for(var i in users){ + userDict[users[i].title.replaceAll("/", "-")] = true; +} const files = fs.readdirSync(usersFolderPath); -console.log(files); + for (file in files) { let stats = fs.statSync(usersFolderPath + files[file]); - if (files[file] != 'users.json' && files[file] != '_index.md' && files[file] != 'tempusers.txt' && files[file] != 'oldindex.md') { - console.log('deleting: ', files[file]); + if (files[file] != 'users.json' && files[file] != '_index.md') { + + if (stats.isDirectory()) { - fs.rmdirSync(usersFolderPath + files[file], { recursive: true, force: true }); + + if(!userDict[files[file].replaceAll("/", "-")]){ + console.log('deleting: ', files[file]); + fs.rmdirSync(usersFolderPath + files[file], { recursive: true, force: true }); + } } else { + console.log('deleting: ', files[file]); fs.unlinkSync(usersFolderPath + files[file]); } } @@ -40,8 +50,9 @@ puppeteer var userMDFile = "---\n\ title: \""+ users[i].title + "\"\n\ slug: \"users\"\n\ - tags: []\n\ + tags: ["+users[i].tags+"]\n\ externalUrl: \""+ users[i].url + "\"\n\ + date: "+(9999-i)+"-08-08\n\ showDate: false\n\ showAuthor: false\n\ showReadingTime: false\n\ @@ -51,34 +62,17 @@ puppeteer layoutBackgroundHeaderSpace: false\n\ \r---\n"; - var dir = usersFolderPath + i + users[i].title; + var dir = usersFolderPath + users[i].title.replaceAll("/", "-"); if (!fs.existsSync(dir)) { fs.mkdirSync(dir); } fs.writeFileSync(dir + '/index.md', userMDFile); - await page.goto(users[i].url); - await page.screenshot({ path: dir + "/feature.png" }); + await page.screenshot({ path: dir + "/feature.jpg" }); } await browser.close(); - }); - - -/* -puppeteer - .launch({ - defaultViewport: { - width: 1280, - height: 800, - }, - }) - .then(async (browser) => { - const page = await browser.newPage(); - await page.goto("https://nytimes.com"); - await page.screenshot({ path: "nyt-puppeteer.png" }); - await browser.close(); - });*/ \ No newline at end of file + }); \ No newline at end of file