sana137.in

Sana's gatsbyjs-based blog
git clone http://git.hanabi.in/repos/sana137.in.git
Log | Files | Refs | README | LICENSE

README.md (2463B)


      1 ## First things first
      2 
      3 For updating the website (assuming you have the repo locally):
      4 
      5 ```zsh
      6 yarn depoly
      7 ```
      8 
      9 1. Go to GitHub repo [Settings](https://github.com/cognitive137/sana137.in/settings).
     10 2. Look for "GitHub Pages" from bottom.
     11 3. Update "Custom domain" accordingly.
     12 
     13 # Usage note
     14 
     15 ## Getting the repo
     16 
     17 ```bash
     18 # Run the following commands
     19 git clone https://github.com/cognitive137/sana137.in
     20 cd path/to/cloned/repo
     21 yarn # to install dependencies
     22 ```
     23 
     24 ## Adding new blogs
     25 
     26 1. Create a folder in `blogs`, say _`newBlogPost`_.
     27 2. In the folder _`newBlogPost`_, create a markdown file **`index.md`**.
     28 3. Put the content of the blog in the **`index.md`** file.
     29 
     30 ## Adding background to tags
     31 
     32 Adding cover to tags is handled via an array of objects. That array is located at `./src/tagData/index.js`.
     33 
     34 That file contains an array `tagData`. Each element of `tagData`, must be an object, with two keys, `tag` and `cover`.
     35 
     36 Each object should match:
     37 
     38 ```javascript
     39 {
     40   tag: 'unique tag here',
     41   cover: 'www.example.com/path/to/cover'
     42 }
     43 ```
     44 
     45 Make sure you don't repeat tags in array in `./src/tagData/index.js`, else none will be chosen.
     46 
     47 ## Frontmatter
     48 
     49 In every blog post, it is necessary to start the blog post with the following content:
     50 
     51 ```markdown
     52 ---
     53 cover: 'www.example.com/path/to/cover/img'
     54 date: 'yyyy-mm-dd'
     55 excerpt: 'Add excerpt here'
     56 page: 'true/false'
     57 path: '/uri-to-blog-post'
     58 tags: ['some', 'tags', 'in', 'lowercase']
     59 title: 'Blog Post’s Title'
     60 
     61 ---
     62 ```
     63 
     64 ### Note
     65 
     66 1. All except the excerpt are necessary fields. Make sure you would not be able to escape the single or double quotes in excerpt, so make use of enclosing alternatives.
     67 
     68 2. In case if you do not wish to have any tags, keep that parameter to `['']`.
     69 
     70 3. Use the _`yyyy-mm-dd`_ date format.
     71 
     72 4. Make sure path starts with **`/`**, and is unique.
     73 
     74 ## Testing your addition renders perfectly
     75 
     76 Run the following commands to test if the site works fine locally.
     77 
     78 ```bash
     79 yarn clean
     80 yarn start
     81 # Look in the terminal on which port the site is live.
     82 # navigate to localhost:port/path-to-new-blog
     83 ```
     84 
     85 ## Updating the website
     86 
     87 Run the following commands to update the website:
     88 
     89 ```bash
     90 yarn clean
     91 yarn build
     92 yarn deploy
     93 ```
     94 Run the following commands to push the local changes to remote:
     95 
     96 ```bash
     97 git add .
     98 git commit -m "Added new blog (or) made some changes"
     99 git push
    100 ```
    101 
    102 ## Note about styling
    103 
    104 Only the Footer functional component (`src/components/footer.js`) imports `layout.css`.