|
| 1 | +> [!IMPORTANT] |
| 2 | +> If you are migrating from v3 (`git submodule` based) theme to v4 (`hugo modules` based) theme, please read this [migration guide](https://toha-guides.netlify.app/posts/update-v3-to-v4/). |
| 3 | +
|
| 4 | +# Toha |
| 5 | + |
| 6 | +[](https://app.netlify.com/sites/toha/deploys) |
| 7 | +[](https://actions-badge.atrox.dev/hugo-toha/toha/goto?ref=main) |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +[](https://percy.io/b7cb60ab/hugo-toha.github.io) |
| 18 | + |
| 19 | +A [Hugo](https://gohugo.io/) theme for a personal portfolio with minimalist design and responsiveness. |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +- **Example Site:** [hugo-toha.github.io](https://hugo-toha.github.io) |
| 24 | +- **Documentation:** [toha-guides.netlify.app](https://toha-guides.netlify.app/posts) |
| 25 | + |
| 26 | +## Features |
| 27 | + |
| 28 | +- Minimalist Design |
| 29 | +- Fully Responsive |
| 30 | +- Multiple Language Support |
| 31 | +- Carefully Designed Cards |
| 32 | +- Experience Timeline |
| 33 | +- Achievement Gallery |
| 34 | +- Sidebar to Categorize the Posts |
| 35 | +- Short Codes |
| 36 | +- Analytics Support |
| 37 | + - GoatCounter |
| 38 | + - counter.dev |
| 39 | + - Google Analytics |
| 40 | + - Matomo/Piwik |
| 41 | + - [Umami](https://umami.is/) |
| 42 | +- Comment Support |
| 43 | + - [Disqus](https://disqus.com/) |
| 44 | + - [Valine](https://valine.js.org/) |
| 45 | + - [Uttarances](https://utteranc.es/) |
| 46 | + - [Giscus](https://giscus.app/) |
| 47 | + |
| 48 | +For more details about the features please visit [here](https://toha-guides.netlify.app/posts/features/). |
| 49 | + |
| 50 | +## Available Translations |
| 51 | + |
| 52 | +- English |
| 53 | +- বাংলা |
| 54 | +- Français |
| 55 | +- Indonesian |
| 56 | +- Deutsch |
| 57 | +- Español |
| 58 | +- 简体中文 |
| 59 | +- हिन्दी |
| 60 | +- Italiano |
| 61 | +- 日本語 |
| 62 | +- 한국어 |
| 63 | +- русский |
| 64 | +- suomi |
| 65 | +- Tiếng Việt |
| 66 | +- Turkish |
| 67 | +- Arabic (العربية) |
| 68 | +- Português Europeu |
| 69 | +- Català |
| 70 | +- Português Brasileiro |
| 71 | +- Nederlands |
| 72 | +- Hebrew |
| 73 | + |
| 74 | +To know more about how to translate your site, please visit [here](https://toha-guides.netlify.app/posts/translation/). Follow, the data and post format from this [example site](https://hugo-toha.github.io). |
| 75 | + |
| 76 | +## Screenshots |
| 77 | + |
| 78 | +Here are few screenshots from the [example site](https://hugo-toha.github.io). |
| 79 | + |
| 80 | +##### Home Page Sections |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +##### List Page |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +##### Reading Page |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +## Requirements |
| 93 | + |
| 94 | +- Hugo Version 0.118.0 (extended) or higher |
| 95 | +- Go language 1.18 or higher (require for hugo modules) |
| 96 | +- Node version v18.x or later and npm 8.x or later. |
| 97 | + |
| 98 | +## Usage |
| 99 | + |
| 100 | +The easiest way to use this theme is to fork [hugo-toha.github.io](https://github.com/hugo-toha/hugo-toha.github.io) sample repo.Then change the configurations according to your need. |
| 101 | + |
| 102 | +If you want to start from scratch, then follow these steps: |
| 103 | + |
| 104 | +##### 1. Initialize Hugo module on you repo |
| 105 | + |
| 106 | +At first, initialize [Hugo modules](https://gohugo.io/hugo-modules/) in your repo. This will create a `go.mod` file. |
| 107 | + |
| 108 | +```bash |
| 109 | +hugo mod init github.com/<your username>/<your repo name> |
| 110 | +``` |
| 111 | + |
| 112 | +##### 2. Add this theme as your module dependency |
| 113 | + |
| 114 | +Now, in your `hugo.yaml` file, add a `module` section. |
| 115 | + |
| 116 | +```yaml |
| 117 | +# Use Hugo modules to add theme |
| 118 | +module: |
| 119 | + imports: |
| 120 | + - path: github.com/hugo-toha/toha/v4 |
| 121 | +``` |
| 122 | +
|
| 123 | +Check this sample [hugo.yaml](https://github.com/hugo-toha/hugo-toha.github.io/blob/main/hugo.yaml) for further reference. |
| 124 | +
|
| 125 | +##### 3. Update your module |
| 126 | +
|
| 127 | +Now, run this command to load this theme as your module. |
| 128 | +
|
| 129 | +```bash |
| 130 | +hugo mod tidy |
| 131 | +``` |
| 132 | + |
| 133 | +#### Running Locally |
| 134 | + |
| 135 | +Now, you can run your hugo site locally with the following steps: |
| 136 | + |
| 137 | +##### 1. Generate node dependency configuration |
| 138 | + |
| 139 | +Now run the following command to generate node dependency configuration. This will create the a `package.json` file in you repo. |
| 140 | + |
| 141 | +```bash |
| 142 | +hugo mod npm pack |
| 143 | +``` |
| 144 | + |
| 145 | +##### 2. Install dependencies |
| 146 | + |
| 147 | +Install the node dependencies using following command: |
| 148 | +```bash |
| 149 | +npm install |
| 150 | +``` |
| 151 | + |
| 152 | +##### 3. Run your site |
| 153 | + |
| 154 | +Now, run you site locally using following command. |
| 155 | + |
| 156 | +```bash |
| 157 | +hugo server -w |
| 158 | +``` |
| 159 | + |
| 160 | +When you run your site for first time, it will start with the default parameters. It should look similar to the [example site](https://hugo-toha.github.io). However, it will not have any sections in the homepage as we haven't configured them yet. You can configure your site by following the guides from [here](https://toha-guides.netlify.app/posts/configuration/). |
| 161 | + |
| 162 | +## Shortcodes |
| 163 | + |
| 164 | +Here, are some handy shortcodes you can use with this theme. |
| 165 | + |
| 166 | +- [Alert](https://toha-guides.netlify.app/posts/shortcodes/#alert) |
| 167 | +- [Image](https://toha-guides.netlify.app/posts/shortcodes/#image) |
| 168 | +- [Split](https://toha-guides.netlify.app/posts/shortcodes/#split) |
| 169 | +- [Vertical Space](https://toha-guides.netlify.app/posts/shortcodes/#vertical-space) |
| 170 | +- [Video](https://toha-guides.netlify.app/posts/shortcodes/#video) |
| 171 | +- [Mermaid](https://hugo-toha.github.io/posts/shortcodes/#mermaid) |
| 172 | + |
| 173 | +## Contributing |
| 174 | + |
| 175 | +You can contribute to this theme in various ways. You can report a [bug](https://github.com/hugo-toha/toha/issues/new?template=bug.md), file an [feature request](https://github.com/hugo-toha/toha/issues/new?template=feature_request.md), send a PR, [share your thoughts](https://github.com/hugo-toha/toha/issues/new?template=question.md) etc. |
| 176 | + |
| 177 | +Pull requests are most welcome and I will be happy to review. Just follow the following principles: |
| 178 | + |
| 179 | +- Keep it simple. |
| 180 | +- Keep it consistent with the design. |
| 181 | +- Use as few dependencies as possible. |
| 182 | +- Have patience. |
| 183 | + |
| 184 | +> I am not a web developer. I have created this theme for my personal needs. So, it is reasonable to have some flaws in the codes. Feel free to open issues and PRs acknowledging the problems. |
| 185 | +
|
| 186 | +## Local Development |
| 187 | + |
| 188 | +For local development, you can make changes in the theme submodule and test the changes against your own site or this [example site](https://github.com/hugo-toha/hugo-toha.github.io) locally. |
| 189 | + |
| 190 | +### Fork |
| 191 | + |
| 192 | +At first, fork [this repo](https://github.com/hugo-toha/toha). Then, follow the following steps to use the forked theme for local developments, |
| 193 | + |
| 194 | +#### Running the forked theme against the example site |
| 195 | + |
| 196 | +If your want to run your local development against this [example site](https://github.com/hugo-toha/hugo-toha.github.io), follow the following steps: |
| 197 | + |
| 198 | +```bash |
| 199 | +# go to exampleSite directory |
| 200 | +$ cd exampleSite |
| 201 | +# install hugo modules |
| 202 | +$ hugo mod tidy |
| 203 | +# install dependencies |
| 204 | +$ hugo mod npm pack |
| 205 | +$ npm install |
| 206 | +# run the example site locally |
| 207 | +$ hugo server -w |
| 208 | +``` |
| 209 | + |
| 210 | +Now, you can make change in the theme and they will be reflected immediately on the running site. If you need to change any configuration, you can do that in the `hugo.yaml` file inside `exampleSite` folder. If you need to add any content or data, you can create the respective folder inside `exampleSite` directory and add your desired content or data there. |
| 211 | + |
| 212 | +#### Running the forked theme against your own site |
| 213 | + |
| 214 | +If you want to run your local development against your own site, follow the following steps: |
| 215 | + |
| 216 | +**Replace the theme module:** |
| 217 | + |
| 218 | +Open your site's `go.mod` file and replace the `github.com/hugo-toha/toha/v4` with your forked repo's path. For example, if your forked repo is `github.com/<your-github-user>/toha`, then replace the `github.com/hugo-toha/toha/v4` with `github.com/<your-github-user>/toha/v4`. |
| 219 | + |
| 220 | +```go |
| 221 | +module github.com/hugo-toha/hugo-toha.github.io |
| 222 | + |
| 223 | +go 1.19 |
| 224 | + |
| 225 | +require github.com/hugo-toha/toha/v4 v4.0.1-0.20231229170427-d3968ca711ef // indirect |
| 226 | + |
| 227 | +replace( |
| 228 | + github.com/hugo-toha/toha/v4 => github.com/<your-github-user>/toha/v4 <git branch> |
| 229 | +) |
| 230 | +``` |
| 231 | + |
| 232 | +For interactive development, you can replace the theme with your locally cloned fork. For example, if you have cloned your fork in `/home/my-projects/toha`, then replace the `github.com/hugo-toha/toha/v4` with `/home/my-projects/toha`. |
| 233 | + |
| 234 | +```go |
| 235 | +module github.com/hugo-toha/hugo-toha.github.io |
| 236 | + |
| 237 | +go 1.19 |
| 238 | + |
| 239 | +require github.com/hugo-toha/toha/v4 v4.0.1-0.20231229170427-d3968ca711ef // indirect |
| 240 | + |
| 241 | +replace( |
| 242 | + github.com/hugo-toha/toha/v4 => /home/my-projects/toha |
| 243 | +) |
| 244 | +``` |
| 245 | + |
| 246 | +**Update dependencies:** |
| 247 | + |
| 248 | +```bash |
| 249 | +# update hugo modules |
| 250 | +$ hugo mod tidy |
| 251 | +# install dependencies |
| 252 | +$ hugo mod npm pack |
| 253 | +$ npm install |
| 254 | +``` |
| 255 | + |
| 256 | +**Run your site locally:** |
| 257 | + |
| 258 | +```bash |
| 259 | +$ hugo server -w |
| 260 | +``` |
| 261 | + |
| 262 | +From there you can make changes to the source code of the theme while testing with your running Hugo site or the example site. |
| 263 | + |
| 264 | +### Open a PR |
| 265 | + |
| 266 | +When the changes look good, commit and push them to your fork. |
| 267 | + |
| 268 | +```bash |
| 269 | +# stage all the changes |
| 270 | +$ git add . |
| 271 | +# commit the changes with a meaning full commit message |
| 272 | +$ git commit -m "A meaningful commit message" |
| 273 | +# push the commit to your fork |
| 274 | +$ git push my-fork my-feature-branch |
| 275 | +``` |
| 276 | + |
| 277 | +Then, open a PR against `main` branch of [hugo-toha/toha](https://github.com/hugo-toha/toha) from the `my-feature-branch` branch of your own fork. |
| 278 | + |
| 279 | +## Attribution |
| 280 | + |
| 281 | +- Thanks [Anup Deb](https://dribbble.com/anupdeb) for his design guidance. |
| 282 | +- Many of the illustrations have been taken from [iconscout](http://iconscout.com/). |
0 commit comments