From 4a2872171d2a515b98f68913473ceb075e4c66a4 Mon Sep 17 00:00:00 2001 From: Rohan Mohapatra <31756343+rohanmohapatra@users.noreply.github.com> Date: Thu, 18 Jul 2019 19:13:21 +0530 Subject: [PATCH] Added Handles for Twitter, Linkedin and Medium to GitFolio (#84) * Added Handles for Twitter, Linkedin and Medium to GitFolio * Updates README * Updates README --- .github/ISSUE_TEMPLATE/feature-request.md | 4 ++-- README.md | 5 +++++ assets/index.css | 5 +++++ bin/gitfolio.js | 3 +++ build.js | 12 +++++++++--- populate.js | 5 ++++- update.js | 5 ++++- 7 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index a70bf00..fc84cd6 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -5,8 +5,8 @@ about: Request a new feature. # What feature should be added? - +This feature adds Twitter, Linkedin and Medium links to your profile. # Why should this feature be added? - +Since a portfolio is being made, adding these links help improve the profile better. diff --git a/README.md b/README.md index 3ba87db..036ed52 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,12 @@ $ gitfolio build --background https://images.unsplash.com/photo-15572 You could also add in your custom CSS inside `index.css` to give it a more personal feel. +### Add Twitter, LinkedIn and Medium Links on your profile +Twitter, LinkedIn and Medium Links to your profile while building +```sh +gitfolio build --twitter --linkedin --medium +``` ### Let's Publish Head over to GitHub and create a new repository named `username.github.io`, where username is your username. Push the files inside`/dist` folder to repo you just created. diff --git a/assets/index.css b/assets/index.css index 8f0c1eb..522cfce 100644 --- a/assets/index.css +++ b/assets/index.css @@ -337,6 +337,11 @@ body{ font-size:15px; } +.socials { + color: #fff; + text-decoration: none; +} + #blog_section { margin:2vh 0px; padding:2vh 0px !important; diff --git a/bin/gitfolio.js b/bin/gitfolio.js index 35360ed..66be111 100644 --- a/bin/gitfolio.js +++ b/bin/gitfolio.js @@ -18,6 +18,9 @@ program .option('-f, --fork', 'includes forks with repos') .option('-s, --sort [sort]', 'set default sort for repository', 'created') .option('-o, --order [order]', 'set default order on sort', 'asc') + .option('-w, --twitter [handle]', 'set Twitter handle') + .option('-l, --linkedin [username]', 'specify LinkedIn username') + .option('-m, --medium [username]', 'specify Medium username') .action(buildCommand) program diff --git a/build.js b/build.js index 86df9ee..8f45ca9 100644 --- a/build.js +++ b/build.js @@ -63,11 +63,14 @@ async function populateCSS({ await fs.writeFileAsync(config, JSON.stringify(data, null, ' ')); } -async function populateConfig(sort, order, includeFork) { +async function populateConfig(sort, order, includeFork, twitter, linkedin, medium) { const data = await getConfig(); data[0].sort = sort; data[0].order = order; data[0].includeFork = includeFork; + data[0].twitter = twitter; // added twitter + data[0].linkedin = linkedin; // added linkedin + data[0].medium = medium; // added medium await fs.writeFileAsync(config, JSON.stringify(data, null, ' ')); } @@ -76,8 +79,11 @@ async function buildCommand(username, program) { let sort = program.sort ? program.sort : 'created'; let order = program.order ? program.order : "asc"; let includeFork = program.fork ? true : false; - await populateConfig(sort, order, includeFork); - updateHTML(('%s', username), sort, order, includeFork); + let twitter = program.twitter ? program.twitter : null; + let linkedin = program.linkedin ? program.linkedin : null; + let medium = program.medium ? program.medium : null; + await populateConfig(sort, order, includeFork, twitter, linkedin, medium); + updateHTML(('%s', username), sort, order, includeFork, twitter, linkedin, medium); } module.exports = { diff --git a/populate.js b/populate.js index b334346..3dcccad 100644 --- a/populate.js +++ b/populate.js @@ -29,7 +29,7 @@ function convertToEmoji(text) { } } -module.exports.updateHTML = (username, sort, order, includeFork) => { +module.exports.updateHTML = (username, sort, order, includeFork, twitter, linkedin, medium) => { //add data to assets/index.html jsdom.fromFile(`${__dirname}/assets/index.html`, options).then(function (dom) { let window = dom.window, document = window.document; @@ -114,6 +114,9 @@ module.exports.updateHTML = (username, sort, order, includeFork) => {   ${user.company}   ${user.email}   ${user.blog} +    Twitter +    LinkedIn +    Medium    ${user.location}    Available for hire`; //add data to config.json diff --git a/update.js b/update.js index cf58da3..895fcd9 100644 --- a/update.js +++ b/update.js @@ -7,11 +7,14 @@ async function updateCommand() { var sort = data[0].sort; var order = data[0].order; var includeFork = data[0].includeFork; + var twitter = data[0].twitter; + var linkedin = data[0].linkedin; + var medium = data[0].medium; if(username == null || sort == null || order == null || includeFork == null){ console.log("username not found in config.json, please run build command before using update"); return; } - updateHTML(username, sort, order, includeFork); + updateHTML(username, sort, order, includeFork, twitter, linkedin, medium); } module.exports = {