|
1 | | -# Mediumish Blog |
| 1 | +# Mediumish |
2 | 2 |
|
3 | | -Markdown blog template for `rodber/mediumish`. |
| 3 | +> _The Rodo Fork_ of `wowthemesnet/mediumish-vuepress-blog-theme` with super powers. |
4 | 4 |
|
5 | | -This repo is intended to be used as a template for your own markdown blog repo. |
| 5 | +It takes a markdown blog repo and generates a VuePress app that can be configured to be automatically published to GitHub pages. |
| 6 | + |
| 7 | +[View Demo](https://rodolfoberrios.com/) |
| 8 | + |
| 9 | +## Requirements |
| 10 | + |
| 11 | +- A markdown blog repository following a simply scheme (example [rodolfoberrios/blog](https://github.com/rodolfoberrios/blog/)). |
| 12 | + |
| 13 | +### Tree for blog repo |
| 14 | + |
| 15 | +```shell |
| 16 | +./ |
| 17 | +├── .github |
| 18 | +│ └── workflows |
| 19 | +│ └── push-deploy.yml |
| 20 | +├── _posts |
| 21 | +│ └── 2020-07-09-a-post.md |
| 22 | +├── public |
| 23 | +│ ├── avatars |
| 24 | +│ │ └── user.jpg |
| 25 | +│ ├── icons |
| 26 | +│ │ ├── android-chrome-192x192.png |
| 27 | +│ │ └── android-chrome-512x512.png |
| 28 | +│ ├── logo.png |
| 29 | +│ ├── manifest.json |
| 30 | +│ └── photos |
| 31 | +│ └── some-photo.jpg |
| 32 | +└── .vuepress |
| 33 | + ├── config.js |
| 34 | + ├── enhanceApp.js |
| 35 | + └── styles |
| 36 | + ├── index.styl |
| 37 | + └── palette.styl |
| 38 | +``` |
| 39 | + |
| 40 | +### `.github/` folder |
| 41 | + |
| 42 | +Read [Deploying to GitHub pages](#deploying-to-github-pages). |
| 43 | + |
| 44 | +### `_posts/` folder |
| 45 | + |
| 46 | +Contains the posts of the target blog source. |
| 47 | + |
| 48 | +- ⚠ Post name must be in the format `YYYY-MM-DD-<name_here>.md` |
| 49 | +- ⚠ Post must link internal resources using absolute path (Use `/` to map to [`public/` folder](#public-folder)) |
| 50 | + |
| 51 | +Posts use [Front Matter](https://jekyllrb.com/docs/front-matter/) to provide meta: |
| 52 | + |
| 53 | +```md |
| 54 | +--- |
| 55 | +date: 2020-07-09 11:32:02 GMT |
| 56 | +title: Vuelvo a bloguear |
| 57 | +tags: |
| 58 | + - ✊🏾resurrecting |
| 59 | +author: Rodolfo |
| 60 | +summary: Vuelvo a renacer, amado pueblo... Se siente tan vacío sin mi! |
| 61 | +image: /photos/image.jpg |
| 62 | +feed: |
| 63 | + description: Description used in feed |
| 64 | + image: /photos/image-alt.jpg |
| 65 | +--- |
| 66 | +``` |
| 67 | + |
| 68 | +### `public/` folder |
| 69 | + |
| 70 | +Public folder for logos, icons and manifest files that maps to the root. For example, `public/logo.png` will be available at `/logo.png` in the deployed app. |
| 71 | + |
| 72 | +### `.vuepress/` folder |
| 73 | + |
| 74 | +Contains `config.js`, `enhanceApp.js` and `styles/` used by VuePress. These allow to configure your blog name, links, authors and allow to define the colors used by the theme. |
| 75 | + |
| 76 | +## Deploying to GitHub pages |
| 77 | + |
| 78 | +Requirements: |
| 79 | + |
| 80 | +- A GitHub repository for hosting (see [GitHub pages](https://pages.github.com/)). |
| 81 | + |
| 82 | +### Require Secrets (on deploy repo) |
| 83 | + |
| 84 | +> 🧔🏾 Your own clone of this repo is the deploy repo of yours. |
| 85 | +
|
| 86 | +- `REPO_BLOG` example [`rodolfoberrios/blog`](https://github.com/rodolfoberrios/blog/) |
| 87 | +- `REPO_BLOG_ACCESS_TOKEN` token for the repo above |
| 88 | +- `REPO_HOSTING` example `rodolfoberrios/rodolfoberrios.github.io` |
| 89 | +- `REPO_HOSTING_ACCESS_TOKEN` token for the repo above |
| 90 | +- `CNAME` example `rodolfoberrios.com` |
| 91 | + |
| 92 | +### Require Secrets (on blog repo) |
| 93 | + |
| 94 | +> 🧔🏾 Your own repo with your markdown files is the blog repo of yours. |
| 95 | +
|
| 96 | +- `REPO_BLOG_DEPLOY` the repo used for deploy example `rodolfoberrios/mediumish` |
| 97 | +- `REPO_BLOG_DEPLOY_USERNAME` username with access to blog deploy repo |
| 98 | +- `REPO_BLOG_DEPLOY_TOKEN` PAT for the username above |
| 99 | + |
| 100 | +> ⚠ The personal access token must grant access to `repo` scope. |
| 101 | +
|
| 102 | +Configure the blog repo to **automatically trigger** a new deploy by adding `.github/workflows/push-deploy.yml` in the blog repo. |
| 103 | + |
| 104 | +```yml |
| 105 | +name: Push deploy |
| 106 | +on: push |
| 107 | +jobs: |
| 108 | + push-deploy: |
| 109 | + runs-on: ubuntu-latest |
| 110 | + steps: |
| 111 | + - name: Push it |
| 112 | + run: | |
| 113 | + curl -XPOST -u "${{ secrets.REPO_BLOG_DEPLOY_USERNAME }}:${{ secrets.REPO_BLOG_DEPLOY_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${{ secrets.REPO_BLOG_DEPLOY }}/dispatches --data '{"event_type": "build_application"}' |
| 114 | +``` |
| 115 | +
|
| 116 | +## Deploying with shell |
| 117 | +
|
| 118 | +- Requires [yarn](https://yarnpkg.com/). |
| 119 | +
|
| 120 | +Install all the dependencies. |
| 121 | +
|
| 122 | +```sh |
| 123 | +yarn |
| 124 | +``` |
| 125 | + |
| 126 | +Copy `config.sh.dist` to `config.sh`. |
| 127 | + |
| 128 | +```sh |
| 129 | +cp config.sh.dist config.sh |
| 130 | +``` |
| 131 | + |
| 132 | +Change the variables in `config.sh` to match the target project. In this file you will configure the repositories for blog sourcing and hosting. |
| 133 | + |
| 134 | +### Shell commands |
| 135 | + |
| 136 | +Make sure that `deploy.sh` is executable. |
| 137 | + |
| 138 | +```sh |
| 139 | +chmod +x deploy.sh |
| 140 | +``` |
| 141 | + |
| 142 | +Command syntax: |
| 143 | + |
| 144 | +```sh |
| 145 | +./deploy.sh <to> <doSource> |
| 146 | +``` |
| 147 | + |
| 148 | +`<to>` deploy options: |
| 149 | + |
| 150 | +| Option | Effect | |
| 151 | +| ------ | --------------------- | |
| 152 | +| `dev` | Deploys dev preview | |
| 153 | +| `prod` | Deploys to production | |
| 154 | + |
| 155 | +`<doSource>` option: |
| 156 | + |
| 157 | +| Option | Effect | |
| 158 | +| ------- | ----------------------------------------------- | |
| 159 | +| `true` | Source `blog/` from the target blog repo | |
| 160 | +| `false` | Skip the blog sourcing (will use local `blog/`) | |
| 161 | +| `dir` | Use target dir as `blog/` source (copied) | |
| 162 | + |
| 163 | +## Known bugs |
| 164 | + |
| 165 | +- 🤷🏾 Feeds won't work in `dev`, only in `build`. |
| 166 | +- ⚠ Posts markdown files, (`YYYY-MM-DD-<name_here>.md`) must not start with a digit at `name_here`. No idea why the `service-worker` breaks on those. |
0 commit comments