├── .github ├── pull_request_template.md ├── workflows │ ├── conventional_commits_checker.yml │ └── greetings.yml └── ISSUE_TEMPLATE │ ├── feature.yml │ └── bug.yml ├── .vscode └── settings.json ├── 1.png ├── 2.png ├── 3.png ├── favicon.ico ├── public └── css │ ├── Black_logo.png │ └── styles.css ├── logo_info.txt ├── routers ├── contact.js └── auth.js ├── views ├── about.ejs ├── error.ejs ├── post.ejs ├── blogs.ejs ├── home2.ejs ├── 404.ejs ├── home.ejs ├── signin.ejs ├── compose.ejs ├── signup.ejs ├── partials │ ├── footer.ejs │ └── header.ejs └── contact.ejs ├── models ├── contact.js └── auth.js ├── controllers ├── middleware.js ├── contact.js └── auth.js ├── .gitignore ├── package.json ├── CONTRIBUTING.md ├── README.md ├── app.js ├── code_of_conduct.md └── blog.json /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Description** 2 | 3 | This PR fixes # -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "liveServer.settings.port": 5501 3 | } -------------------------------------------------------------------------------- /1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kritika30032002/Blog_Website/HEAD/1.png -------------------------------------------------------------------------------- /2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kritika30032002/Blog_Website/HEAD/2.png -------------------------------------------------------------------------------- /3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kritika30032002/Blog_Website/HEAD/3.png -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kritika30032002/Blog_Website/HEAD/favicon.ico -------------------------------------------------------------------------------- /public/css/Black_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kritika30032002/Blog_Website/HEAD/public/css/Black_logo.png -------------------------------------------------------------------------------- /logo_info.txt: -------------------------------------------------------------------------------- 1 | 2 | Fonts used: LocalBreweryFour-Regular 3 | 4 | Colors used: 757195,F6F6F0 5 | 6 | Icon url: https://thenounproject.com/term/journal/1430208 7 | -------------------------------------------------------------------------------- /routers/contact.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const {contactUs} = require("../controllers/contact"); 3 | 4 | const router = express.Router(); 5 | 6 | router.route("/contact").post(contactUs); 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /views/about.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | 3 |
4 |
5 |

About

6 | 7 |

<%=blog2%>

8 | 9 | 10 |
11 | <%- include("partials/footer"); -%> -------------------------------------------------------------------------------- /models/contact.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | 3 | const { Schema } = mongoose; 4 | 5 | const contactSchema = new Schema({ 6 | name: String, 7 | email: String, 8 | message: String, 9 | }); 10 | 11 | module.exports.Contact = mongoose.model("Contact", contactSchema); -------------------------------------------------------------------------------- /.github/workflows/conventional_commits_checker.yml: -------------------------------------------------------------------------------- 1 | name: Conventional Commits 2 | 3 | on: 4 | pull_request: 5 | branches: [main] 6 | 7 | jobs: 8 | build: 9 | name: Conventional Commits 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - uses: webiny/action-conventional-commits@v1.1.0 14 | -------------------------------------------------------------------------------- /controllers/middleware.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const favicon = require('serve-favicon'); 3 | const path = require('path'); 4 | 5 | const app = express(); 6 | 7 | // Serve the favicon from the 'public' folder 8 | app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); 9 | 10 | // Other routes and middleware... 11 | 12 | app.listen(3000); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env 3 | .env.example 4 | 5 | logs/ 6 | *.log 7 | 8 | pids/ 9 | *.pid 10 | *.seed 11 | *.pid.lock 12 | 13 | lib/ 14 | bin/ 15 | build/ 16 | 17 | data/ 18 | mongod.lock 19 | 20 | *.ejs 21 | 22 | .vscode/ 23 | .idea/ 24 | .sublime 25 | *.swp 26 | *.swo 27 | *.swn 28 | *.bak 29 | *.orig 30 | 31 | favicon.ico 32 | 33 | .DS_Store 34 | 35 | Thumbs.db 36 | -------------------------------------------------------------------------------- /models/auth.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | const passportLocalMongoose = require("passport-local-mongoose"); 3 | 4 | const { Schema } = mongoose; 5 | 6 | const authSchema = new Schema({ 7 | name: String, 8 | email: String, 9 | password: String, 10 | }); 11 | 12 | authSchema.plugin(passportLocalMongoose, { usernameField: "email" }); 13 | 14 | module.exports.User = mongoose.model("User", authSchema); 15 | -------------------------------------------------------------------------------- /routers/auth.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const { 3 | signUp, 4 | signUpPage, 5 | signinPage, 6 | signIn, 7 | logOut, 8 | } = require("../controllers/auth"); 9 | const passport = require("passport"); 10 | 11 | const router = express.Router(); 12 | 13 | router.route("/signup").get(signUpPage).post(signUp); 14 | router 15 | .route("/signin") 16 | .get(signinPage) 17 | .post(passport.authenticate("local",{failureRedirect:'/error'}), signIn); 18 | 19 | router.post("/logout", logOut); 20 | 21 | module.exports = router; 22 | -------------------------------------------------------------------------------- /views/error.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 |
6 | HOME 7 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /controllers/contact.js: -------------------------------------------------------------------------------- 1 | const { Contact } = require("../models/contact"); 2 | 3 | module.exports.contactUs = (req, res) => { 4 | res.render("contact"); 5 | }; 6 | 7 | module.exports.contactUs = async (req, res, next) => { 8 | const { name, email, message } = req.body; 9 | try { 10 | if(!name || !email || !message){ 11 | throw "All field are required" 12 | } 13 | const contactUs = await Contact.create({ 14 | name,email,message 15 | }) 16 | await contactUs.save() 17 | return res.send( 18 | "Message received successfully" 19 | ) 20 | } catch (error) { 21 | next(error); 22 | } 23 | }; -------------------------------------------------------------------------------- /views/post.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | 3 |
4 |

<%=nextBlogTitle%>

5 |
6 | by: <%=nextBlogAuthor%> . 7 | 8 | March 18th, 2024 9 |
10 | Image not Available 11 |
12 |

<%=nextBlog%>

13 |
14 |
15 | 16 | <%- include("partials/footer"); -%> 17 | -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | steps: 12 | - uses: actions/first-interaction@v1 13 | with: 14 | repo-token: ${{ secrets.GITHUB_TOKEN }} 15 | issue-message: 'Hey, @${{ github.actor }} welcome to Blog Website repository.🎊 Thank you so much for taking the time to point this out.🙌' 16 | pr-message: 'Hey, @${{ github.actor }} welcome to Blog Website repository.🎊 Thank you so much for taking the effort to make our project better! 🙌 Keep making such awesome contributions!' -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ejs", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "start": "node app", 8 | "dev": "nodemon app", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "Kritika Gupta", 12 | "license": "ISC", 13 | "dependencies": { 14 | "body-parser": "^1.18.3", 15 | "dotenv": "^16.3.1", 16 | "ejs": "^3.1.8", 17 | "express": "^4.16.3", 18 | "express-session": "^1.17.3", 19 | "lodash": "^4.17.21", 20 | "mongoose": "^7.6.3", 21 | "passport": "^0.6.0", 22 | "passport-local-mongoose": "^8.0.0", 23 | "serve-favicon": "^2.5.0" 24 | }, 25 | "devDependencies": { 26 | "nodemon": "^3.0.1", 27 | "prettier": "3.0.3" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /views/blogs.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 |
3 | <% blogs.forEach(function(blog) { %> 4 |
6 |
7 | Image not Available 8 |
9 |
10 |

11 | <%= blog.title %> 12 |

13 |
14 |

15 | <%= blog.content.substring(0, 100) + " ..." %> 16 |

17 |
18 |
19 | 22 |
23 | <% }); %> 24 |
25 | 26 | <%- include("partials/footer"); -%> -------------------------------------------------------------------------------- /views/home2.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | 3 |
4 |
5 |

Home

6 | 7 |

<%= blog1 %>

8 | 9 |
10 | <% posts.forEach(function(post) { %> 11 |
12 |
13 | 14 |
15 |

<%= post.title %>

16 |
17 |
21 |
22 |

<%= post.blog.substring(0, 100) + " ..." %>

23 | Read more 26 |
27 |
28 |
29 |
30 | <% }); %> 31 |
32 | 33 |
34 | 40 | Read Blogs 47 |
48 |
49 | 50 | <%- include("partials/footer"); -%> 51 | -------------------------------------------------------------------------------- /views/404.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 404 - Page Not Found 8 | 9 | 45 | 46 | 47 | 48 |
49 |
50 | 51 |
52 |

404 - Page Not Found

53 |

Sorry, the page you are looking for does not exist.

54 |

Go back to the home page

55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /views/home.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | 3 |
4 |
5 |

Home

6 | 7 |

<%= blog1 %>

8 | 9 |
10 | <% posts.forEach(function(post) { %> 11 |
12 |
13 | 14 |
15 |

<%= post.title %>

16 |
17 |
21 |
22 |

<%= post.blog.substring(0, 100) + " ..." %>

23 | Read more 26 |
27 |
28 |
29 |
30 | <% }); %> 31 |
32 | 33 |
34 | 41 | Read Blogs 48 |
49 |
50 | 51 | <%- include("partials/footer"); -%> 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this project 3 | title: "[Feature] " 4 | labels: "feature" 5 | 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: Is your feature request related to a problem? Please describe. 10 | - type: textarea 11 | attributes: 12 | label: Describe the feature you'd like to request 13 | description: A clear and concise description of what the problem is. 14 | placeholder : | 15 | Ex. I'm always frustrated when [...] 16 | validations: 17 | required: true 18 | - type: textarea 19 | attributes: 20 | label: Describe the solution you'd like 21 | description: A clear and concise description of what you want to happen. 22 | placeholder : | 23 | Ex. I want the solution like [...] 24 | validations: 25 | required: true 26 | - type: textarea 27 | attributes: 28 | label: Describe alternatives you've considered 29 | description: A clear and concise description of any alternative solutions or features you've considered. 30 | placeholder : | 31 | Ex. I want to extend the function A by adding someting more 32 | validations: 33 | required: false 34 | - type: textarea 35 | attributes: 36 | label: Additional context 37 | description: Add any other context or screenshots about the feature request here. 38 | placeholder : | 39 | context, screenshots, related links , etc. 40 | validations: 41 | required: false 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | title: "[Bug]: " 4 | labels: ["bug", "triage"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to fill out this bug report! 10 | - type: input 11 | id: contact 12 | attributes: 13 | label: Contact Details 14 | description: How can we get in touch with you if we need more info? 15 | placeholder: ex. email@example.com 16 | validations: 17 | required: false 18 | - type: textarea 19 | id: what-happened 20 | attributes: 21 | label: What happened? 22 | description: Also tell us, what did you expect to happen? 23 | placeholder: Tell us what you see! 24 | value: "A bug happened!" 25 | validations: 26 | required: true 27 | - type: dropdown 28 | id: browsers 29 | attributes: 30 | label: What browsers are you seeing the problem on? 31 | multiple: true 32 | options: 33 | - Firefox 34 | - Chrome 35 | - Safari 36 | - Microsoft Edge 37 | - type: textarea 38 | id: logs 39 | attributes: 40 | label: Relevant log output 41 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 42 | render: shell 43 | - type: checkboxes 44 | id: terms 45 | attributes: 46 | label: Code of Conduct 47 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/FOSS-Community/website-fossc/blob/main/CODE_OF_CONDUCT.md) 48 | options: 49 | - label: I agree to follow this project's Code of Conduct 50 | required: true 51 | -------------------------------------------------------------------------------- /controllers/auth.js: -------------------------------------------------------------------------------- 1 | const { User } = require("../models/auth"); 2 | 3 | // Render sign-up page 4 | module.exports.signUpPage = (req, res) => { 5 | res.render("signup"); 6 | }; 7 | 8 | // Handle sign-up logic 9 | module.exports.signUp = async (req, res, next) => { 10 | const { name, email, password } = req.body; 11 | const newUser = new User({ name, email }); 12 | 13 | // Regular expressions for password validation 14 | const specialCharRegex = /[!@#$%^&*(),.?":{}|<>]/; 15 | const capitalLetterRegex = /[A-Z]/; 16 | 17 | // Check if the password meets the criteria 18 | if (!specialCharRegex.test(password) || !capitalLetterRegex.test(password)) { 19 | return res.render("error", { 20 | error1: "Password must contain at least one special character and one capital letter", 21 | }); 22 | } 23 | 24 | try { 25 | // Register the new user 26 | const registeredUser = await User.register(newUser, password); 27 | 28 | // Log in the user after registration 29 | await req.logIn(registeredUser, (err) => { 30 | if (err) { 31 | return res.render("error", { error1: err }); 32 | } 33 | res.redirect("/home"); 34 | }); 35 | } catch (error) { 36 | // Handle registration error 37 | res.render("error", { 38 | error1: error, 39 | }); 40 | } 41 | }; 42 | 43 | // Render sign-in page 44 | module.exports.signinPage = (req, res) => { 45 | res.render("signin"); 46 | }; 47 | 48 | // Handle sign-in logic 49 | module.exports.signIn = (req, res) => { 50 | res.redirect("/home"); 51 | }; 52 | 53 | // Log out the user 54 | module.exports.logOut = (req, res, next) => { 55 | req.logOut(() => { 56 | try { 57 | res.redirect("/"); 58 | } catch (error) { 59 | next(error); 60 | } 61 | }); 62 | }; 63 | -------------------------------------------------------------------------------- /views/signin.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | <main style="margin-top: 10px"> 3 | <section id="contact" class="contact"> 4 | <h2 5 | style=" 6 | font-size: 27px; 7 | margin-bottom: 20px; 8 | font-weight: 500; 9 | color: #1abc9c; 10 | " 11 | > 12 | Sign In 13 | </h2> 14 | 15 | <form action="/signin" method="post"> 16 | <label for="email">Email:</label> 17 | <input 18 | type="email" 19 | id="email" 20 | name="email" 21 | required 22 | style=" 23 | width: 100%; 24 | padding: 10px; 25 | margin: 5px 0; 26 | border: 1px solid #ccc; 27 | border-radius: 4px; 28 | color: #000; 29 | " 30 | /> 31 | 32 | <label for="password">Password:</label> 33 | <input 34 | type="password" 35 | id="password" 36 | placeholder="Enter password" 37 | name="password" 38 | required 39 | minlength="5" 40 | style=" 41 | width: 100%; 42 | padding: 10px; 43 | margin: 5px 0; 44 | border: 1px solid #ccc; 45 | border-radius: 4px; 46 | color: #000; 47 | " 48 | /> 49 | 50 | <button 51 | type="submit" 52 | style=" 53 | background-color: #1abc9c; 54 | color: #fff; 55 | padding: 10px 20px; 56 | border: none; 57 | border-radius: 4px; 58 | cursor: pointer; 59 | margin-top: 10px; 60 | " 61 | > 62 | Sign In 63 | </button> 64 | <p>Don't have an account? <a href="/signup"><u>Sign up</u></a></p> 65 | </form> 66 | </section> 67 | </main> 68 | 69 | <%- include("partials/footer"); -%> 70 | -------------------------------------------------------------------------------- /views/compose.ejs: -------------------------------------------------------------------------------- 1 | <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css"> 2 | <%- include("partials/header"); -%> 3 | <h1>Compose</h1> 4 | 5 | <form class="" action="/compose" method="post" novalidate onsubmit="return validateForm();"> 6 | <div class="form-group"> 7 | <label> Image </label> 8 | <input type="file" name="newImage" id="" class="form-control"> 9 | <label>Title</label> 10 | <input class="form-control" type="text" name="newTitle" required> 11 | 12 | <label>Post</label> 13 | <textarea class="form-control" name="newBlog" rows="5" cols="30" required></textarea> 14 | <div id="editor"></div> 15 | </div> 16 | 17 | <button class="btn btn-primary" type="submit" name="submit">Publish</button> 18 | </form> 19 | 20 | <%- include("partials/footer"); -%> 21 | 22 | <script src="https://cdn.ckeditor.com/ckeditor5/40.2.0/classic/ckeditor.js"></script> 23 | <script> 24 | ClassicEditor 25 | .create( document.querySelector( '#editor' ) ) 26 | .catch( error => { 27 | console.error( error ); 28 | } ); 29 | </script> 30 | 31 | <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script> 32 | <script> 33 | 34 | function validateForm() { 35 | var title = document.querySelector('input[name="newTitle"]').value; 36 | var post = document.querySelector('textarea[name="newBlog"]').value; 37 | 38 | if (title.trim() === '' || post.trim() === '') { 39 | 40 | Toastify({ 41 | text: "Title and Post cannot be empty", 42 | duration: 3000, 43 | gravity: "top", 44 | position: "center", 45 | backgroundColor: "red", 46 | }).showToast(); 47 | 48 | return false; 49 | } 50 | return true; 51 | } 52 | </script> 53 | -------------------------------------------------------------------------------- /views/signup.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | <main style="margin-top: 10px"> 3 | <section id="contact" class="contact"> 4 | <h2 5 | style=" 6 | font-size: 27px; 7 | margin-bottom: 20px; 8 | font-weight: 500; 9 | color: #1abc9c; 10 | " 11 | > 12 | Sign Up 13 | </h2> 14 | 15 | <form action="/signup" method="post"> 16 | <label for="name">Name:</label> 17 | <input 18 | type="text" 19 | id="name" 20 | name="name" 21 | required 22 | style=" 23 | width: 100%; 24 | padding: 10px; 25 | margin: 5px 0; 26 | border: 1px solid #ccc; 27 | border-radius: 4px; 28 | color: black; 29 | " 30 | /> 31 | 32 | <label for="email">Email:</label> 33 | <input 34 | type="email" 35 | id="email" 36 | name="email" 37 | required 38 | style=" 39 | width: 100%; 40 | padding: 10px; 41 | margin: 5px 0; 42 | border: 1px solid #ccc; 43 | border-radius: 4px; 44 | color: black; 45 | " 46 | /> 47 | 48 | <label for="password">Password:</label> 49 | <input 50 | type="password" 51 | id="password" 52 | name="password" 53 | placeholder="Enter password" 54 | required 55 | minlength="5" 56 | pattern="^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{5,}$" 57 | title="Minimum five characters, at least one letter, one number and one special character" 58 | style=" 59 | width: 100%; 60 | padding: 10px; 61 | margin: 5px 0; 62 | border: 1px solid #ccc; 63 | border-radius: 4px; 64 | color: black; 65 | " 66 | /> 67 | 68 | <button 69 | type="submit" 70 | style=" 71 | background-color: #1abc9c; 72 | color: #fff; 73 | padding: 10px 20px; 74 | border: none; 75 | border-radius: 4px; 76 | cursor: pointer; 77 | margin-top: 10px; 78 | " 79 | > 80 | Sign Up 81 | </button> 82 | </form> 83 | <p>Already have an account? <a href="/signin"><u>Sign in</u></a></p> 84 | </section> 85 | </main> 86 | 87 | <%- include("partials/footer"); -%> 88 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Welcome to our open-source project! We appreciate your interest in contributing to our HTML, CSS, JavaScript, EJS and MongoDB project. By contributing, you help us create a better software for everyone. 4 | 5 | Before you start contributing, please take a moment to read the following guidelines to ensure a smooth and effective contribution process. 6 | 7 | ## Table of Contents 8 | 9 | 1. [Getting Started](#getting-started) 10 | 2. [How Can I Contribute?](#how-can-i-contribute) 11 | - [Reporting Bugs](#reporting-bugs) 12 | - [Suggesting Enhancements](#suggesting-enhancements) 13 | - [Working on Issues](#working-on-issues) 14 | - [Submitting Pull Requests](#submitting-pull-requests) 15 | 16 | ## Getting Started 17 | 18 | - Ensure you have Node.js and MongoDB installed on your local machine. 19 | - Fork the repository on GitHub. 20 | - Clone your forked repository locally: `git clone https://github.com/Kritika30032002/Blog_Website.git` 21 | - Change your directory to the project: `cd Blog_Website` 22 | - Install project dependencies: `npm install` 23 | 24 | ## How Can I Contribute? 25 | 26 | ### Reporting Bugs 27 | 28 | If you find a bug, please ensure the bug was not already reported by searching on GitHub under [Issues](https://github.com/Kritika30032002/Blog_Website/issues). If you can't find an existing issue addressing the problem, please [open a new issue](https://github.com/Kritika30032002/Blog_Website/issues/new) and provide detailed information about the bug. 29 | 30 | ### Suggesting Enhancements 31 | 32 | If you have an idea for an enhancement, we welcome your input. Before creating a new enhancement issue, please check the existing issues to see if your enhancement idea has already been discussed. If it hasn't, [create a new issue](https://github.com/Kritika30032002/Blog_Website/issues/new) and outline your enhancement proposal. 33 | 34 | ### Working on Issues 35 | 36 | Feel free to pick any open issue from our [issue tracker](https://github.com/Kritika30032002/Blog_Website/issues) that you find interesting. Comment on the issue that you would like to work on it so that others are aware you are addressing it. If you need more context on a particular issue, please ask for clarification. 37 | 38 | ### Submitting Pull Requests 39 | 40 | 1. Fork the repository and create your branch from `main`: `git checkout -b your-branch-name` 41 | 2. Make your changes and test thoroughly. 42 | 3. Add, commit, and push your changes to your forked repository. 43 | 4. Create a pull request to the `main` branch of the original repository. 44 | 5. Clearly describe your changes and why you think they should be merged. 45 | 6. Be willing to make any requested changes or improvements. 46 | 47 | Thank you for contributing to our project! 🚀 48 | -------------------------------------------------------------------------------- /views/partials/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | </div> 3 | <div class="footer-padding"></div> 4 | <div class="footer" id="footer"> 5 | <a class="foot " href="https://www.linkedin.com/in/kritika-gupta-343458212/" target="_blank" rel="noopener" aria-label="LinkedIn"> 6 | <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-linkedin" viewBox="0 0 16 16"> 7 | <path d="M0 1.146C0 .513.526 0 1.175 0h13.65C15.474 0 16 .513 16 1.146v13.708c0 .633-.526 1.146-1.175 1.146H1.175C.526 16 0 15.487 0 14.854zm4.943 12.248V6.169H2.542v7.225zm-1.2-8.212c.837 0 1.358-.554 1.358-1.248-.015-.709-.52-1.248-1.342-1.248S2.4 3.226 2.4 3.934c0 .694.521 1.248 1.327 1.248zm4.908 8.212V9.359c0-.216.016-.432.08-.586.173-.431.568-.878 1.232-.878.869 0 1.216.662 1.216 1.634v3.865h2.401V9.25c0-2.22-1.184-3.252-2.764-3.252-1.274 0-1.845.7-2.165 1.193v.025h-.016l.016-.025V6.169h-2.4c.03.678 0 7.225 0 7.225z"/> 8 | </svg> 9 | </a> 10 | <a class="foot" href="https://github.com/Kritika30032002/Blog_Website" target="_blank" rel="noopener" aria-label="GitHub"> 11 | <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16"> 12 | <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/> 13 | </svg> 14 | </a> 15 | <a class="foot" href="https://discord.com/invite/5NDvQhZNED" target="_blank" rel="noopener" aria-label="GitHub"> 16 | <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16"> 17 | <path d="M13.545 2.907a13.2 13.2 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.2 12.2 0 0 0-3.658 0 8 8 0 0 0-.412-.833.05.05 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.04.04 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032q.003.022.021.037a13.3 13.3 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019q.463-.63.818-1.329a.05.05 0 0 0-.01-.059l-.018-.011a9 9 0 0 1-1.248-.595.05.05 0 0 1-.02-.066l.015-.019q.127-.095.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.05.05 0 0 1 .053.007q.121.1.248.195a.05.05 0 0 1-.004.085 8 8 0 0 1-1.249.594.05.05 0 0 0-.03.03.05.05 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.2 13.2 0 0 0 4.001-2.02.05.05 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.03.03 0 0 0-.02-.019m-8.198 7.307c-.789 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612m5.316 0c-.788 0-1.438-.724-1.438-1.612s.637-1.613 1.438-1.613c.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612"/> 18 | </svg> 19 | </a> 20 | <p>Made with ❤️ By <a class="foot" href="https://github.com/Kritika30032002">Kritika Gupta</a></p> 21 | </div> 22 | </div> 23 | </body> 24 | </html> 25 | -------------------------------------------------------------------------------- /views/contact.ejs: -------------------------------------------------------------------------------- 1 | <%- include("partials/header"); -%> 2 | <main style="margin-top: 10px"> 3 | <section class="contact contact-default" id="contact"> 4 | <h2 5 | style=" 6 | font-size: 27px; 7 | margin-bottom: 20px; 8 | font-weight: 500; 9 | color: #1abc9c; 10 | " 11 | > 12 | Contact Us 13 | </h2> 14 | <p> 15 | If you have any questions or concerns, please don't hesitate to contact 16 | us. You can reach us by filling out the form below: 17 | </p> 18 | 19 | <form action="/contact" method="post"> 20 | <label for="name">Name:</label> 21 | <input 22 | type="text" 23 | id="name" 24 | name="name" 25 | id="name" 26 | required 27 | style=" 28 | width: 100%; 29 | padding: 10px; 30 | margin: 5px 0; 31 | border: 1px solid #ccc; 32 | border-radius: 4px; 33 | color: black; 34 | " 35 | /> 36 | 37 | <label for="email">Email:</label> 38 | <input 39 | type="email" 40 | id="email" 41 | name="email" 42 | id="email" 43 | required 44 | style=" 45 | width: 100%; 46 | padding: 10px; 47 | margin: 5px 0; 48 | border: 1px solid #ccc; 49 | border-radius: 4px; 50 | color: black; 51 | " 52 | /> 53 | 54 | <label for="message">Message:</label> 55 | <textarea 56 | id="message" 57 | name="message" 58 | rows="4" 59 | id="message" 60 | required 61 | style=" 62 | width: 100%; 63 | padding: 10px; 64 | margin: 5px 0; 65 | border: 1px solid #ccc; 66 | border-radius: 4px; 67 | color: #000; 68 | " 69 | ></textarea> 70 | 71 | <button 72 | type="submit" 73 | id="send_button" 74 | style=" 75 | background-color: #1abc9c; 76 | color: #fff; 77 | padding: 10px 20px; 78 | border: none; 79 | border-radius: 4px; 80 | cursor: pointer; 81 | " 82 | > 83 | Send Message 84 | </button> 85 | </form> 86 | </section> 87 | </main> 88 | <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> 89 | <script src="https://smtpjs.com/v3/smtp.js"></script> 90 | <script> 91 | var btn = document.getElementById("send_button"); 92 | btn.addEventListener("click", function (e) { 93 | var name = document.getElementById("name").value; 94 | var email = document.getElementById("email").value; 95 | var message = document.getElementById("message").value; 96 | e.preventDefault(); 97 | Email.send({ 98 | Host: "smtp.elasticemail.com", 99 | // Please create account on 100 | // https://app.elasticemail.com/api/create-account?_gl=1%2Ad8ieqx%2A_up%2AMQ..%2A_ga%2AMTczMDgzODM4NS4xNzEwNjg0OTY4%2A_ga_9GFVDHZ5M5%2AMTcxMDY4NDk2Ni4xLjAuMTcxMDY4NDk2Ni4wLjAuMA..&r=20b444a2-b3af-4eb8-bae7-911f6097521c 101 | // and get a username and password. Add them here to allow recieval of emails 102 | Username: "username_smtp", 103 | Password: "generate_from_smtp_server", 104 | 105 | 106 | To: "kritikagupta3003@gmail.com", 107 | From: `${email}`, 108 | Subject: `Blog Website Issue By: ${name}`, 109 | Body: `<br><br> ${message} <br><br> <strong>Name:<\strong> ${name} <br> <strong>Email:<\strong> ${email}`, 110 | }) 111 | .then(async (message) => { 112 | if (message == "OK") { 113 | await Swal.fire({ 114 | title: "Success!", 115 | text: "Message Sent Successfully!", 116 | icon: "success", 117 | background: "#1A1A1A", 118 | color: "#fff", 119 | customClass: "swal-size-sm", 120 | }); 121 | } else { 122 | await Swal.fire({ 123 | icon: "error", 124 | title: "Oops...", 125 | text: "Something went wrong!", 126 | background: "#1A1A1A", 127 | color: "#fff", 128 | customClass: "swal-size-sm", 129 | }); 130 | } 131 | }) 132 | .then(async (res) => { 133 | await window.location.reload(); 134 | }); 135 | }); 136 | </script> 137 | <%- include("partials/footer"); -%> 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Join the [Discord](https://discord.gg/5NDvQhZNED) for any further discussion 2 | 3 | # Blog Website 4 | 5 | ## Introduction 6 | 7 | Welcome to the Blog Website, a platform that empowers users to create, share, and engage with blogs. This repository contains the source code for the website, which securely stores blogs in a database while providing a seamless experience for writers and readers. 8 | 9 | ## Features 10 | 11 | - **User-Friendly Interface:** The intuitive user interface allows users to effortlessly compose and edit blogs. 12 | 13 | - **Database Storage:** All blogs are securely stored in a database, making it easy to manage and retrieve them whenever needed. 14 | 15 | - **Responsive Design:** The website is designed to be responsive, ensuring an optimal experience on both desktop and mobile devices. 16 | 17 | ## Getting Started 18 | 19 | ### Prerequisites 20 | 21 | Before you begin, make sure you have the following prerequisites installed on your local machine: 22 | 23 | - [Node.js](https://nodejs.org/) 24 | 25 | - [MongoDB](https://www.mongodb.com/) 26 | 27 | ### Installation 28 | 29 | 1. **Clone the Repository** 30 | 31 | Clone this repository to your local machine: 32 | 33 | ``` 34 | git clone https://github.com/Kritika30032002/Blog_Website.git 35 | ``` 36 | 37 | 2. **Navigate to the Project Directory** 38 | 3. **Install Dependencies** 39 | ``` npm install ``` 40 | 41 | ### Configuration 42 | To configure the project, follow these steps: 43 | 44 | - **Create a .env File** 45 | Create a .env file in the root directory of the project to store your environment variables. Replace your_session_secret with a secure, random string for session management. 46 | 47 | ``` 48 | PORT=3000 49 | MONGODB_URI=mongodb://localhost:27017/blog-website 50 | SESSION_SECRET=your_session_secret 51 | ``` 52 | 53 | ### Running the Application 54 | 1. **Start the application** 55 | Start the application by running: 56 | ```npm start``` 57 | or 58 | ```node app.js``` 59 | 2. **Access the website** 60 | Open your web browser and navigate to http://localhost:3000 to access the blog website. 61 | 62 | ## 🚀 How to Contribute to This Project 🚀 63 | 64 | We’re excited to have you contribute to this project! Follow these simple steps to get started: 65 | 66 | 1. **🍴 Fork the Repository** 67 | - Go to the [repository page](https://github.com/Kritika30032002/Blog_Website). 68 | - Click the *Fork* button (top right). This creates a copy of the project in your GitHub account. 69 | 70 | 2. **💻 Clone Your Fork** 71 | - Once the repository is forked, clone it to your local machine. Open your terminal and run: 72 | ``` bash 73 | git clone 74 | https://github.com/Kritika30032002/Blog_Website.git 75 | ``` 76 | 77 | - Replace your-username with your GitHub username. 78 | 79 | 3. **🌿 Create a New Branch** 80 | - Before making any changes, create a new branch for your work: 81 | ``` bash 82 | git checkout 83 | -b your-branch-name 84 | ``` 85 | 86 | - Choose a branch name that describes what you're working on, such as fix-navbar or add-contact-form. 87 | 88 | 4. **🛠️ Make Your Changes** 89 | - Open the project files in your code editor (like VS Code) and make your changes. 90 | - You can contact the project manager for any queiries you have. 91 | 92 | 5. **✅ Test Your Changes** 93 | - Make sure your changes work correctly by testing the website locally. Open the index.html file in your browser to see your updates. 94 | 95 | 6. **💬 Commit Your Changes** 96 | - Once your changes are ready, commit them with a descriptive message: 97 | ```bash 98 | git add . 99 | git commit -m "Added feature X or Fixed issue Y" 100 | ``` 101 | 102 | 103 | 7. **📤 Push Your Changes** 104 | - Push your changes to your forked repository on GitHub: 105 | ``` bash 106 | git push origin your-branch-name 107 | ``` 108 | 109 | 110 | 8. **🔄 Create a Pull Request (PR)** 111 | - Go back to the original repository [here](https://github.com/Kritika30032002/Blog_Website). 112 | - Click the *Compare & pull request* button. 113 | - Write a short description of your changes and submit the pull request (PR). 114 | 115 | 9. **🔎Review Changes** 116 | - The project manager will review your PR. If your changes are approved, your request would be merged. 117 | 118 | --- 119 | 120 | By following these steps, you can easily contribute to this project! If you have any questions, feel free to ask in the repository’s discussion or issue section. 121 | 122 | 123 | ## 📢Contributors📢 124 | 125 | ## Our Amazing Contributors 126 | 127 | 128 | <a align="center" href="https://github.com/Kritika30032002/Blog_Website/graphs/contributors"> 129 | <img src="https://contrib.rocks/image?repo=Kritika30032002/Blog_Website" /> 130 | </a> 131 | 132 | 133 | 134 | 135 | ### Contributing 136 | We enthusiastically welcome contributions from the community. If you discover a bug or have an enhancement in mind, please don't hesitate to open an issue or create a pull request. Your input is invaluable to us. 137 | 138 | 139 | Join the [discord server](https://discord.gg/JdFsJPrayj) for more discussion: 140 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const bodyParser = require("body-parser"); 3 | const ejs = require("ejs"); 4 | const _ = require("lodash"); 5 | require("dotenv").config(); 6 | const mongoose = require("mongoose"); 7 | const session = require("express-session"); 8 | const passport = require("passport"); 9 | const authRouter = require("./routers/auth"); 10 | const contactRouter = require("./routers/contact"); 11 | const { User } = require("./models/auth"); 12 | const blogsData=require('./blog.json') 13 | const blogs1=blogsData.blogs 14 | const fs = require('fs'); 15 | const homeStartingContent = 16 | "Step into the world of words with our user-friendly blog platform! Whether you're a seasoned writer or just getting started, our intuitive interface makes composing and editing blogs a breeze! Join our community of storytellers, where your unique voice is celebrated. Ready to share your thoughts? Click the 'Compose' button below and let your creativity flow! Your blogging journey begins here."; 17 | const aboutContent = 18 | "Welcome to Daily Journal, your go-to destination for daily journaling and blogging. We understand the power of words and the importance of sharing your thoughts with the world. Our platform is designed to empower individuals like you to express themselves, reflect on their daily lives, and connect with a community of like-minded writers."; 19 | const contactContent = 20 | "Scelerisque eleifend donec pretium vulputate sapien. Rhoncus urna neque viverra justo nec ultrices. Arcu dui vivamus arcu felis bibendum. Consectetur adipiscing elit duis tristique. Risus viverra adipiscing at in tellus integer feugiat. Sapien nec sagittis aliquam malesuada bibendum arcu vitae. Consequat interdum varius sit amet mattis. Iaculis nunc sed augue lacus. Interdum posuere lorem ipsum dolor sit amet consectetur adipiscing elit. Pulvinar elementum integer enim neque. Ultrices gravida dictum fusce ut placerat orci nulla. Mauris in aliquam sem fringilla ut morbi tincidunt. Tortor posuere ac ut consequat semper viverra nam libero."; 21 | 22 | const app = express(); 23 | const PORT = process.env.PORT || 3000; 24 | const sessionConfig = { 25 | name: "session", 26 | secret: process.env.SESSION_SECRET, 27 | resave: false, 28 | saveUninitialized: true, 29 | cookie: { 30 | httpOnly: true, 31 | expires: Date.now() + 1000 * 60 * 60 * 24 * 7, 32 | maxAge: 1000 * 60 * 60 * 24 * 7, 33 | }, 34 | }; 35 | 36 | app.set("view engine", "ejs"); 37 | 38 | app.use( 39 | bodyParser.urlencoded({ 40 | extended: true, 41 | }) 42 | ); 43 | app.use(express.static("public")); 44 | app.use(session(sessionConfig)); 45 | app.use(express.json()); 46 | app.use(passport.initialize()); 47 | app.use(passport.session()); 48 | passport.use(User.createStrategy()); 49 | passport.serializeUser(User.serializeUser()); 50 | passport.deserializeUser(User.deserializeUser()); 51 | 52 | let posts = []; 53 | 54 | app.use((req, res, next) => { 55 | res.locals.user = req.user; 56 | next(); 57 | }); 58 | 59 | app.get("/", function (req, res) { 60 | res.render("home", { 61 | blog1: homeStartingContent, 62 | posts: [], 63 | }); 64 | }); 65 | 66 | app.get("/home", function (req, res) { 67 | res.render("home2", { 68 | blog1: homeStartingContent, 69 | posts: posts, 70 | }); 71 | }); 72 | 73 | app.get("/about", function (req, res) { 74 | res.render("about", { 75 | blog2: aboutContent, 76 | }); 77 | }); 78 | 79 | app.get("/contact", function (req, res) { 80 | res.render("contact", { 81 | blog3: contactContent, 82 | }); 83 | }); 84 | 85 | app.get("/compose", function (req, res) { 86 | res.render("compose"); 87 | }); 88 | 89 | app.post("/compose", function (req, res) { 90 | const post = { 91 | title: req.body.newTitle, 92 | blog: req.body.newBlog, 93 | image: req.body.newImage, 94 | }; 95 | const post1 = { 96 | title: req.body.newTitle, 97 | content: req.body.newBlog, 98 | image: req.body.newImage, 99 | 100 | }; 101 | posts.push(post); 102 | blogsData.blogs.push(post1) 103 | const jsonString = JSON.stringify(blogsData, null, 2); 104 | fs.writeFileSync('./blog.json', jsonString, 'utf-8'); 105 | res.redirect("/home"); 106 | }); 107 | 108 | app.get("/posts/:postName", function (req, res) { 109 | const requestedTitle = _.lowerCase(req.params.postName); 110 | 111 | posts.forEach(function (post) { 112 | const storedTitle = _.lowerCase(post.title); 113 | 114 | if (storedTitle === requestedTitle) { 115 | res.render("post", { 116 | nextBlogTitle: post.title, 117 | nextBlog: post.blog, 118 | }); 119 | } 120 | }); 121 | }); 122 | 123 | app.get("/blogs", function (req, res) { 124 | res.render("blogs",{blogs: blogsData.blogs}); 125 | }); 126 | 127 | app.get("/error", function (req, res) { 128 | res.render("error",{error1: "Unauthorised Access"}); 129 | }); 130 | 131 | app.get("/blogs/:blogName", function (req, res) { 132 | const requestedTitle = _.lowerCase(req.params.blogName); 133 | 134 | blogsData.blogs.forEach(function (blog) { 135 | const storedTitle = _.lowerCase(blog.title); 136 | 137 | if (storedTitle === requestedTitle) { 138 | res.render("post", { 139 | nextBlogImage: blog.image, 140 | nextBlogTitle: blog.title, 141 | nextBlogAuthor: blog.author, 142 | nextBlog: blog.content, 143 | }); 144 | } 145 | }); 146 | }); 147 | 148 | app.use("/", authRouter); 149 | app.use("/", contactRouter); 150 | 151 | app.get("*", (req, res) => { 152 | res.status(404).render("404"); 153 | }); 154 | 155 | mongoose 156 | .connect(process.env.MONGODB_URI) 157 | .then(() => console.log("connected")) 158 | .catch((error) => console.log(error)); 159 | app.listen(PORT, function () { 160 | console.log(`Server started on port ${PORT}`); 161 | }); -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Blog Website Project Code of Conduct 2 | 3 | ## Welcome 4 | 5 | Welcome to the **Blog Website** repository! This project is a platform that empowers users to create, share, and engage with blogs. The repository contains the source code for the website, which securely stores blogs in a database while providing a seamless experience for both writers and readers. Our goal is to foster an inclusive, respectful, and collaborative community where contributors can work together to enhance the platform and provide a robust experience for users. 6 | 7 | ## Our Pledge 8 | 9 | We as members, contributors, and leaders pledge to make participation in the **Blog Website** project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 10 | 11 | We are committed to contributing to an open, welcoming, diverse, inclusive, and healthy community, where all contributors feel respected, supported, and encouraged in their efforts to build a dynamic and interactive blogging platform. 12 | 13 | ## Our Standards 14 | 15 | To maintain a positive, collaborative, and respectful environment in the **Blog Website** project, all participants are expected to follow these standards: 16 | 17 | ### Positive Behavior: 18 | - **Respectful Communication**: Treat others with respect, ensuring that discussions are professional, constructive, and contribute to the project’s goals. 19 | - **Constructive Feedback**: Provide feedback that is aimed at helping others improve, delivered in a helpful and encouraging manner. 20 | - **Collaboration**: Work openly and effectively with others, sharing ideas and knowledge to overcome challenges and enhance the platform’s features. 21 | - **Inclusivity**: Use language and behavior that welcomes and includes all participants, regardless of their background, experience, or skill level. 22 | - **Recognition**: Acknowledge and appreciate the efforts of all contributors, whether they contribute code, design, or ideas. 23 | - **Professionalism**: Maintain professionalism in all interactions, ensuring that the project’s goals and values are upheld. 24 | 25 | ### Unacceptable Behavior: 26 | - **Harassment**: Any form of harassment, including unwelcome comments, personal attacks, or inappropriate behavior, is strictly prohibited. 27 | - **Discrimination**: Discriminatory language or behavior based on personal identity, beliefs, or background will not be tolerated. 28 | - **Disrespect**: Engaging in dismissive or inflammatory comments, trolling, or disruptive behavior that undermines the collaborative nature of the project is unacceptable. 29 | - **Privacy Violations**: Sharing private or sensitive information about others without their explicit consent is prohibited. 30 | - **Unethical Conduct**: Misusing the project’s resources, violating ethical standards, or promoting false information is not allowed. 31 | - **Disruption**: Any actions that intentionally disrupt or interfere with the progress of the project or collaboration of the community will not be tolerated. 32 | 33 | ## Project Goals 34 | 35 | The **Blog Website** project aims to provide a platform where users can create and engage with blogs in a secure and user-friendly environment. The primary goals of the project include: 36 | 37 | - **Blog Creation & Management**: Allowing users to write, share, edit, and manage their blogs through a seamless interface. 38 | - **Community Engagement**: Providing features that allow users to engage with blogs by commenting and interacting with content. 39 | - **Security & Data Integrity**: Ensuring that blogs and user data are securely stored and protected within the platform’s database. 40 | - **Open Source Contributions**: Encouraging developers, designers, and content creators to contribute to the platform’s ongoing development and feature improvements. 41 | 42 | ## Enforcement Responsibilities 43 | 44 | Community leaders and maintainers of the **Blog Website** project are responsible for enforcing this Code of Conduct. They are expected to: 45 | 46 | - Clearly communicate the standards for acceptable behavior and ensure that all participants are aware of them. 47 | - Address violations of the Code of Conduct in a timely, fair, and transparent manner. 48 | - Take appropriate corrective actions, such as removing inappropriate comments, posts, or contributions that violate community standards. 49 | - Apply disciplinary measures, including temporary or permanent bans, for repeated or serious violations of the Code of Conduct. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies to all spaces managed by the **Blog Website** project, including GitHub repositories, issue trackers, discussions, and other communication platforms. It also applies when community members represent the project in public spaces, such as conferences, online events, or forums. 54 | 55 | ## Reporting Violations 56 | 57 | If you experience or witness behavior that violates this Code of Conduct, please report it through the project’s communication channels (e.g., GitHub issues or discussions). All reports will be handled confidentially, and community leaders will take appropriate action to address the situation and prevent further violations. 58 | 59 | ## Consequences of Unacceptable Behavior 60 | 61 | If a community member is found to have violated this Code of Conduct, the community leaders may take the following actions: 62 | 63 | 1. **Correction**: A private conversation with the individual to address the violation and provide guidance on how to improve their behavior. 64 | 2. **Warning**: A formal warning outlining the unacceptable behavior and providing expectations for future conduct. 65 | 3. **Temporary Suspension**: A temporary suspension from participating in the project or community spaces, with the possibility of reinstatement after review. 66 | 4. **Permanent Ban**: Permanent removal from the project and all community spaces for repeated or severe violations. 67 | 68 | ## Enforcement Guidelines 69 | 70 | Community leaders will follow these guidelines when determining the consequences for violations of this Code of Conduct: 71 | 72 | 1. **Correction**: 73 | - **Community Impact**: A minor violation that causes minimal disruption to the project. 74 | - **Consequence**: A private conversation to clarify the violation and provide guidance on behavior improvement. 75 | 76 | 2. **Warning**: 77 | - **Community Impact**: A moderate violation that negatively affects the collaborative environment of the project. 78 | - **Consequence**: A formal warning with clear expectations for future behavior. 79 | 80 | 3. **Temporary Suspension**: 81 | - **Community Impact**: A significant violation that harms the community or disrupts the project’s progress. 82 | - **Consequence**: Temporary suspension from participating in the project, with the possibility of reinstatement after review. 83 | 84 | 4. **Permanent Ban**: 85 | - **Community Impact**: A severe or repeated violation that undermines the project’s goals or the community’s values. 86 | - **Consequence**: Permanent removal from the project and all related spaces. 87 | 88 | ## Building a Positive Community 89 | 90 | At **Blog Website**, we are dedicated to creating a welcoming, inclusive, and supportive community where developers, designers, and users can collaborate to build a robust blogging platform. By working together, we can create a space where all contributors feel empowered to share their ideas, learn, and help improve the project. Let’s work together with respect, integrity, and a shared passion for creating a dynamic and secure blogging platform. 91 | 92 | ## Attribution 93 | 94 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available [here](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). 95 | -------------------------------------------------------------------------------- /blog.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "blogs": [ 4 | { 5 | "id": 4, 6 | "image": "https://images.unsplash.com/photo-1602192509154-0b900ee1f851?w=400&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OHx8bWVkaXRhdGlvbnxlbnwwfHwwfHx8MA%3D%3D", 7 | "title": "Exploring the World of Meditation", 8 | "author": "Mindful Maven", 9 | "content": "Meditation is a journey inward, a pathway to inner peace and self-discovery. In the stillness of meditation, one can find solace and clarity. Dive into the world of mindfulness and explore the transformative power of quiet reflection." 10 | }, 11 | { 12 | "id": 2, 13 | "image": "https://images.unsplash.com/photo-1690844623570-b5304dceae3b?w=400&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NHx8bW9ybmluZyUyMHJpdHVhbHN8ZW58MHx8MHx8fDA%3D", 14 | "title": "The Magic of Morning Rituals", 15 | "author": "Rise-and-Shine Enthusiast", 16 | "content": "The way you start your morning sets the tone for the entire day. Embrace the magic of morning rituals to foster positivity and productivity. Begin with a mindful moment – savor your first cup of coffee or tea. Let the warmth and aroma awaken your senses. Engage in gentle stretching to invigorate your body. As you breathe deeply, visualize your goals for the day. Journal your thoughts and set intentions. Establishing a morning routine creates a sense of stability and purpose. Whether it's a brisk walk, reading a chapter, or a moment of gratitude, find rituals that resonate with you. Harness the power of mornings to create a life that aligns with your aspirations." 17 | }, 18 | { 19 | "id": 3, 20 | "image": "https://media.istockphoto.com/id/1428409996/photo/closeup-of-female-chef-in-restaurant-decorates-the-meal.webp?b=1&s=170667a&w=0&k=20&c=iUbrN968TVR32sU8x6OCQbHrIUSJorIEZjWQI2d7P-w=", 21 | "title": "Culinary Adventures", 22 | "author": "Epicurean Explorer", 23 | "content": "Embark on a culinary journey to nourish your soul and delight your taste buds. Explore diverse flavors, textures, and aromas that elevate the dining experience. Start with simple pleasures – a homemade meal shared with loved ones. Experiment with ingredients, infuse creativity into your dishes, and savor the joy of cooking. Venture beyond your comfort zone and indulge in global cuisines. Discover the stories behind each recipe and the cultural tapestry woven into every bite. From the sizzle of a pan to the harmony of spices, culinary adventures awaken the senses. Embrace the art of cooking as a form of self-expression and a celebration of life's rich tapestry." 24 | }, 25 | { 26 | "id": 1, 27 | "title": "Embracing the Art of Mindfulness", 28 | "image": "https://media.istockphoto.com/id/1437656226/photo/three-people-meditating-outdoors.jpg?s=1024x1024&w=is&k=20&c=SAcBmuOBsxt6PmcdL2s1VjunEBcD65sJ9Q8xgmoimeA=", 29 | "author": "Mindful Maven", 30 | "content": "In the hustle and bustle of modern life, finding moments of stillness becomes a precious endeavor. Mindfulness, the practice of being present in the current moment without judgment, offers a serene refuge in our fast-paced world. Picture yourself in a quiet space, surrounded by nature's symphony. As you take a deep breath, feel the cool breeze on your skin. Inhale, exhale – a simple rhythm that connects you with the essence of now. Mindfulness isn't about emptying the mind but rather observing thoughts without attachment. It's a journey inward, exploring the depths of your consciousness. Through regular practice, you cultivate a profound awareness that extends to your daily experiences. Embrace mindfulness as a gift to yourself. Let it be the compass guiding you through the ebb and flow of life. In this oasis of tranquility, discover the art of mindfulness and unlock a world of inner peace and clarity." 31 | }, 32 | { 33 | "id":5, 34 | "title":"Finding the common point between Technology and Creativity", 35 | "content":"Growing up, I was always drawn to both the logical precision of technology and the boundless possibilities of creative expression. From tinkering with gadgets to exploring the depths of storytelling, I found joy in weaving together the analytical and the imaginative. However, as I entered the realm of higher education, I felt pressured to choose between these seemingly disparate interests.My first year as a technology student was a whirlwind of lectures, assignments, and late-night coding sessions. While I thrived in the structured environment of problem-solving and logical reasoning, I couldn’t shake the feeling of something missing. It wasn’t until I stumbled upon a course in digital media that I realized the importance of integrating creativity into my technical pursuits.As I delved into the world of digital media, I discovered a newfound sense of freedom and self-expression. From graphic design to multimedia storytelling, I found avenues to channel my creativity while still leveraging my technical skills. Suddenly, coding wasn’t just about solving equations; it was a tool for bringing ideas to life, for building immersive digital experiences that resonated with audiences on a deeper level.One project that particularly stands out is a multimedia presentation I created for a class assignment. Combining interactive visuals, audio elements, and animated graphics, I was able to convey complex concepts in a way that was engaging and accessible. It was a moment of realization — technology wasn’t just a means to an end; it was a canvas for creative expression.But finding my voice wasn’t without its challenges. Balancing the rigorous demands of my technical coursework with the creative exploration of digital media often felt like walking a tightrope. There were moments of frustration, self-doubt, and the nagging fear of not being “technical” enough. Yet, with each challenge came growth — a deeper understanding of myself, my passions, and the unique perspective I bring to the table.As I progressed through my studies, I sought out opportunities to bridge the gap between technology and creativity. Whether through collaborative projects, extracurricular activities, or personal exploration, I embraced every chance to explore the intersection of these seemingly disparate worlds.Today, as I stand on the brink of graduation, I am grateful for the journey that has brought me to this moment. I’ve come to realize that being a technology student doesn’t mean sacrificing creativity; rather, it’s about finding innovative ways to marry the two. Whether it’s through designing intuitive user interfaces, crafting compelling narratives, or pushing the boundaries of digital art, I am committed to continuing my pursuit of creative expression within the realm of technology." 36 | }, 37 | { 38 | "id":6, 39 | "title":"Finding Solitude in a Noisy World", 40 | "content":"In today's fast-paced and constantly buzzing world, finding moments of solitude can feel like searching for a needle in a haystack. We're bombarded with notifications, messages, and the constant hum of technology. Yet, amidst this chaos, carving out pockets of peace and quiet is essential for our mental well-being.Solitude doesn't necessarily mean being physically alone; it's more about finding inner peace and tranquility regardless of our surroundings. It's about disconnecting from the noise of the world and reconnecting with ourselves.Finding solitude in a noisy world is not always easy, but it's essential for our mental, emotional, and spiritual well-being. By intentionally creating moments of quiet reflection and disconnection, we cultivate a deeper sense of inner peace and resilience to navigate the challenges of modern life. So, take a deep breath, unplug from the chaos, and reconnect with the serenity that lies within." 41 | }, 42 | { 43 | "id":7, 44 | "title":"Cultivating Resilience: Navigating Life's Challenges with Strength and Grace", 45 | "content":"Life is full of unexpected twists and turns, and no matter how carefully we plan, we are bound to encounter obstacles and setbacks along the way. In the face of adversity, cultivating resilience becomes essential – the ability to bounce back from challenges with strength, determination, and grace.Resilience is not about avoiding hardship or denying the pain of difficult experiences; rather, it's about facing adversity head-on and finding ways to grow stronger as a result. It's a skill that can be developed and nurtured, empowering us to navigate life's ups and downs with greater ease and resilience. Cultivating resilience is an ongoing process that requires patience, practice, and perseverance. By adopting a growth mindset, building a strong support network, practicing self-compassion, finding meaning in adversity, cultivating healthy coping strategies, maintaining perspective, and staying flexible and adapt, you can navigate life's challenges with strength, resilience, and grace. Remember that resilience is not about avoiding hardship, but rather about facing it with courage and resilience, knowing that you have the inner strength to overcome whatever comes your way." 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /views/partials/header.ejs: -------------------------------------------------------------------------------- 1 | <!doctype html> 2 | <html lang="en" dir="ltr"> 3 | <head> 4 | <meta charset="utf-8" /> 5 | <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> 6 | <title>Daily Journal 7 | 8 | 12 | 13 | 14 | 15 | 150 | 207 | 215 | 216 | 217 |
218 | -------------------------------------------------------------------------------- /public/css/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | display: flex; 3 | justify-content: space-between; 4 | align-items: center; 5 | flex-direction: column; 6 | min-height: 100vh; 7 | background-color: #f4f4f4; /* Set your desired background color */ 8 | transition: 9 | background-color 0.5s, 10 | color 0.5s; 11 | } 12 | 13 | .grid { 14 | display: grid; 15 | } 16 | .grid-columns-3 { 17 | grid-template-columns: auto auto auto; 18 | } 19 | .gap-1 { 20 | gap: 10px; 21 | } 22 | .gap-2 { 23 | gap: 20px; 24 | } 25 | .gap-3 { 26 | gap: 30px; 27 | } 28 | .gap-4 { 29 | gap: 40px; 30 | } 31 | .px-1 { 32 | padding-inline: 10px; 33 | } 34 | .px-2 { 35 | padding-inline: 20px; 36 | } 37 | .px-3 { 38 | padding-inline: 30px; 39 | } 40 | 41 | .nav1 { 42 | display: flex; 43 | justify-content: space-between; 44 | } 45 | .container-fluid { 46 | padding-top: 70px; 47 | padding-bottom: 70px; 48 | } 49 | 50 | .navbar { 51 | padding-top: 15px; 52 | padding: 15px; 53 | border: 0; 54 | border-radius: 0; 55 | margin-bottom: 0; 56 | font-size: 12px; 57 | letter-spacing: 2px; 58 | width: 100%; 59 | transition: 60 | background-color 0.5s, 61 | color 0.5s; 62 | display: flex; 63 | justify-content: space-between; 64 | align-items: center; 65 | } 66 | .menu-toggle { 67 | display: none; 68 | cursor: pointer; 69 | font-size: 25px; 70 | color: #565555; 71 | background: none; 72 | border: none; 73 | background-color: rgba(99, 99, 99, 0.3); 74 | border-radius: 4px; 75 | padding: 2px; 76 | height: 50%; 77 | margin-top: 7px; 78 | } 79 | .menu { 80 | list-style: none; 81 | margin: 0; 82 | padding: 0; 83 | display: flex; 84 | } 85 | 86 | .menu a { 87 | text-decoration: none; 88 | font-size: 18px; 89 | } 90 | .navbar-nav li a:hover { 91 | color: #1abc9c !important; 92 | 93 | transition: color 0.5s ease-in-out; 94 | } 95 | 96 | .active-nav-item { 97 | color: #1abc9c !important; 98 | 99 | transition: color 0.5s ease-in-out; 100 | } 101 | 102 | @media (max-width: 746px) { 103 | .menu { 104 | display: none; 105 | 106 | position: absolute; 107 | top: 60px; 108 | left: 0; 109 | width: 100%; 110 | background-color: rgba(70, 69, 69, 0.95); 111 | z-index: 1; 112 | } 113 | 114 | .menu.show { 115 | display: flex; 116 | margin-top: 50px; 117 | border-radius: 3px; 118 | } 119 | .menu li a { 120 | text-align: center; 121 | } 122 | .menu-toggle { 123 | display: block; 124 | text-align: center; 125 | } 126 | .navbar-brand { 127 | text-align: center; 128 | } 129 | .menu-toggle.show { 130 | display: block; 131 | } 132 | #toogleicon { 133 | position: absolute; 134 | right: 20px; 135 | } 136 | .navbar-logo { 137 | position: absolute; 138 | left: 15px; 139 | } 140 | } 141 | .navbar-nav li a::before { 142 | content: ""; 143 | position: absolute; 144 | background: #1abc9c; 145 | 146 | width: 100%; 147 | height: 4px; 148 | left: 10%; 149 | bottom: 15px; 150 | transform: scaleY(0); 151 | transition: 0.5s ease-out; 152 | } 153 | 154 | .navbar-nav li a:hover::before { 155 | transform: scaleY(1); 156 | bottom: 15px; 157 | width: 80%; 158 | } 159 | /* Make the navbar-brand text bold */ 160 | .navbar-brand { 161 | font-size: 24px; 162 | font-weight: bold; 163 | padding-left: 120px; 164 | } 165 | .logo-brand { 166 | display: flex; 167 | justify-content: space-between; 168 | } 169 | .navbar-logo { 170 | width: 100px; /* Adjust the width as needed */ 171 | height: 80px; /* Adjust the height as needed */ 172 | background-image: url("Black_logo.png"); /* Replace with the path to your image */ 173 | background-size: contain; 174 | background-repeat: no-repeat; 175 | color: #555; 176 | } 177 | .compose { 178 | margin: 20px; 179 | padding: 15px; 180 | font-size: 20px; 181 | } 182 | 183 | .compose:hover { 184 | background-color: #1abc9c; 185 | } 186 | 187 | .compose a { 188 | color: black; 189 | text-decoration: none; 190 | color: #fff; 191 | } 192 | 193 | .footer { 194 | position: fixed; 195 | bottom: 0; 196 | text-align: center; 197 | padding: 10px; 198 | width: 100%; 199 | height: auto; 200 | background-color: #1abc9c; 201 | transition: 202 | background-color 0.5s, 203 | color 0.5s; 204 | } 205 | 206 | .footer p, 207 | .foot { 208 | margin-top: 10px; 209 | font-size: 12px; 210 | color: #fff; 211 | } 212 | 213 | .footer a { 214 | margin-left: 10px; 215 | } 216 | 217 | .main-content { 218 | font-size: 24px; 219 | } 220 | 221 | .post-title { 222 | font-size: 24px; 223 | font-weight: 600; 224 | margin-bottom: 10px; 225 | } 226 | 227 | .post-content { 228 | font-size: 18px; 229 | color: #555; 230 | } 231 | 232 | .card { 233 | /* border: 1px solid #e0e0e0; */ 234 | border-radius: 8px; 235 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); 236 | transition: 237 | transform 0.2s, 238 | box-shadow 0.2s; 239 | background-color: #fff; 240 | } 241 | 242 | .card:hover { 243 | transform: scale(1.01); 244 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 245 | /* background-color: #f8f8f8; */ 246 | } 247 | 248 | .card-image { 249 | width: 90%; 250 | height: 100%; 251 | margin: 0 15px; 252 | padding: 10px; 253 | object-fit: cover; 254 | 255 | } 256 | 257 | .card-title { 258 | font-size: 22px; 259 | font-weight: 600; 260 | margin-left: 40px; 261 | margin-right: 40px; 262 | margin-bottom: 10px; 263 | color: blue; 264 | } 265 | 266 | .card-title-header { 267 | font-size: 24px; 268 | font-weight: 600; 269 | margin-bottom: 10px; 270 | } 271 | 272 | .card-content { 273 | font-size: 16px; 274 | color: #555; 275 | padding: 15px; 276 | } 277 | .card-text { 278 | margin-left: 29px; 279 | margin-right: 30px; 280 | } 281 | /* Dark Mode Styles */ 282 | .dark-mode .card { 283 | background-color: #333; 284 | color: #e0e0e0; 285 | box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1); 286 | } 287 | 288 | .dark-mode .card:hover { 289 | box-shadow: 0 4px 8px rgba(255, 255, 255, 0.2); 290 | } 291 | 292 | .dark-mode .card-title { 293 | color: #90caf9; 294 | } 295 | 296 | .dark-mode .card-content { 297 | color: #bbb; 298 | } 299 | 300 | .detail-container { 301 | width: 80%; 302 | display: flex; 303 | margin: 3% 30px 5%; 304 | padding: 30px 0 40px; 305 | box-shadow: 0 0 3px 0 #cccccc; 306 | background-color: #fff; 307 | flex-direction: column; 308 | align-items: center; 309 | justify-content: space-between; 310 | transition: background-color 0.5s, color 0.5s; 311 | } 312 | 313 | .detail-title{ 314 | color: #000; 315 | margin: 30px 0; 316 | padding: 0 10px; 317 | font-size: 5rem; 318 | text-align: center; 319 | font-family: Georgia, serif; 320 | transition: color 0.5s; 321 | } 322 | 323 | .detail-author{ 324 | color: #545151; 325 | font-family: Georgia, Helvetica, Arial, sans-serif; 326 | font-size: 17px; 327 | font-weight: 100; 328 | font-style: italic; 329 | margin-bottom: 10px; 330 | padding: 0; 331 | transition: color 0.5s; 332 | } 333 | 334 | .detail-image { 335 | width: 80%; 336 | height: auto; /* Maintain aspect ratio */ 337 | object-fit: cover; 338 | object-position: center; 339 | margin: 10px 40px; 340 | } 341 | 342 | .detail-content { 343 | margin: 20px 10%; 344 | font-size: 18px; 345 | line-height: 1.8; 346 | font-family: Helvetica, Arial, sans-serif; 347 | transition: color 0.5s; 348 | } 349 | 350 | /* Dark Mode Styles for Post.ejs*/ 351 | body.dark-mode .detail-container { 352 | background-color: #333; 353 | } 354 | 355 | body.dark-mode .detail-title { 356 | color: #90caf9; 357 | } 358 | 359 | body.dark-mode .detail-author { 360 | color: #bbb; 361 | } 362 | 363 | body.dark-mode .detail-content { 364 | color: #e0e0e0; 365 | } 366 | 367 | 368 | .btn-primary { 369 | background-color: #1abc9c; 370 | color: #fff; 371 | border: none; 372 | padding: 10px 20px; 373 | display: flex; 374 | justify-content: center; 375 | align-items: center; 376 | font-size: 16px; 377 | border-radius: 5px; 378 | text-decoration: none; 379 | transition: background-color 0.2s; 380 | } 381 | 382 | .btn-primary:hover { 383 | background-color: #169c7f; 384 | } 385 | 386 | body.dark-mode { 387 | background-color: #1a1a1a; 388 | color: #fff; 389 | } 390 | 391 | .navbar.dark-mode { 392 | background-color: #1a1a1a; 393 | color: #fff; 394 | } 395 | 396 | .footer.dark-mode { 397 | background-color: #1a1a1a; 398 | color: #fff; 399 | } 400 | 401 | #dark-mode-toggle { 402 | list-style: none; 403 | display: flex; 404 | gap: 10px; 405 | } 406 | 407 | .dark-mode-button { 408 | background: none; 409 | border: none; 410 | cursor: pointer; 411 | padding: 5px; 412 | transition: transform 0.3s ease; 413 | } 414 | 415 | .dark-mode-button:hover { 416 | transform: scale(1.1); 417 | } 418 | 419 | .sun-icon { 420 | display: block; 421 | } 422 | 423 | .moon-icon { 424 | display: none; 425 | } 426 | 427 | body.dark-mode .sun-icon { 428 | display: none; 429 | } 430 | 431 | body.dark-mode .moon-icon { 432 | display: block; 433 | } 434 | .popup_class { 435 | width: 400px; 436 | } 437 | .swal-size-sm { 438 | width: 600px !important; 439 | font-size: 2rem; 440 | } 441 | 442 | @media screen and (max-width: 992px) { 443 | #unorderlist { 444 | display: none; 445 | } 446 | #toogleicon { 447 | display: block; 448 | } 449 | .menu { 450 | display: none; 451 | 452 | position: absolute; 453 | top: 60px; 454 | left: 0; 455 | width: 100%; 456 | background-color: rgba(70, 69, 69, 0.95); 457 | z-index: 1; 458 | } 459 | .menu.show { 460 | display: flex; 461 | margin-top: 50px; 462 | border-radius: 3px; 463 | } 464 | .menu li a { 465 | text-align: center; 466 | } 467 | .menu-toggle { 468 | display: block; 469 | text-align: center; 470 | } 471 | .navbar-brand { 472 | text-align: center; 473 | } 474 | .menu-toggle.show { 475 | display: block; 476 | } 477 | } 478 | .contact { 479 | padding: 20px; 480 | border-radius: 5px; 481 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); 482 | } 483 | .contact.dark-mode { 484 | box-shadow: 0 0 10px rgba(255, 255, 255, 0.36); 485 | } 486 | .contact p { 487 | margin: 15px 0px; 488 | } 489 | .contact a { 490 | color: #169c7f; 491 | font-weight: bold; 492 | } 493 | --------------------------------------------------------------------------------