diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a008932..444697f 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -8,13 +8,13 @@ enableEmoji = true paginate = 20 # Choose one of emacs, trac or perldoc -pygmentsStyle = "emacs" +pygmentsStyle = "monokai" [params] footer = "The Marauders" - description = "You miss 100% of the shots you don't take" + description = "Sky above, sand below & peace within" avatarURL = "https://upload.wikimedia.org/wikipedia/commons/7/7a/1859-Martinique.web.jpg" - customHTML = "" + customHeadHTML = "" showPostsOnHomePage = "popular" [menu] @@ -34,18 +34,18 @@ pygmentsStyle = "emacs" weight = 3 [[menu.main]] - name = "Resume" - url = "/resume/" + name = "Tags" + url = "/tags/" weight = 4 [[menu.main]] - identifier = "linkedin" - pre = "" + identifier = "coffee" + pre = "" url = "/a/" weight = 5 [[menu.main]] identifier = "github" pre = "" - url = "/b/" + url = "https://github.com/526avijitgupta/gokarna" weight = 6 diff --git a/exampleSite/content/posts/emoji-support.md b/exampleSite/content/posts/emoji-support.md index a4db4b5..545b31a 100644 --- a/exampleSite/content/posts/emoji-support.md +++ b/exampleSite/content/posts/emoji-support.md @@ -4,7 +4,7 @@ date: 2020-10-01T17:55:28+08:00 description: "Guide to emoji usage in Hugo and DoIt." tags: ["emoji"] type: post -weight: 1 +weight: 25 --- Emoji can be enabled in a Hugo project in a number of ways. diff --git a/exampleSite/content/posts/lorem-ipsum.md b/exampleSite/content/posts/lorem-ipsum.md index d66e0bb..d98295f 100644 --- a/exampleSite/content/posts/lorem-ipsum.md +++ b/exampleSite/content/posts/lorem-ipsum.md @@ -3,7 +3,6 @@ title: "Lorem Ipsum" date: 2021-04-15T23:39:49+05:30 tags: ["xyz", "def"] type: "post" -weight: 3 --- # Heading 1 diff --git a/exampleSite/content/posts/markdown-syntax.md b/exampleSite/content/posts/markdown-syntax.md index c4db5c9..80427f6 100644 --- a/exampleSite/content/posts/markdown-syntax.md +++ b/exampleSite/content/posts/markdown-syntax.md @@ -1,9 +1,10 @@ --- title: "Markdown Syntax Guide" -date: 2019-06-01T17:55:28+08:00 +date: 2019-06-19 description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements." tags: ["markdown", "css", "html"] type: post +weight: 20 --- This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. diff --git a/exampleSite/content/posts/theme-documentation-advanced.md b/exampleSite/content/posts/theme-documentation-advanced.md new file mode 100644 index 0000000..8bcbf54 --- /dev/null +++ b/exampleSite/content/posts/theme-documentation-advanced.md @@ -0,0 +1,103 @@ +--- +weight: 15 +title: "Theme Documentation - Advanced" +date: 2020-05-06T21:29:01+08:00 +description: "Discover what the Hugo - gokarna theme is all about and the core-concepts behind it." +tags: ["installation", "configuration", "markdown"] +type: post + +--- + +Discover what the Hugo - Gokarna theme is all about and the core-concepts behind it. +TODO: Similar intro as in README, opinionated, authors + +## Content Types + +This theme supports two types of content types: `post` and `page`. To specify them, you need to add them in your markdown metadata. + +### Post + +This is the default blog post type which will be shown in your "Posts" section and who's tags will be indexed. Basically, a normal blog post. + +```markdown +--- +title: "Hello, world!" +date: 2021-01-01 +description: "A blog post" +type: "post" +tags: ["blog"] +--- + +# Hello World! +This is my blog. +``` + +### Page + +We introduced this type to distinguish between blog posts and normal markdown pages. The reason to create this was to give the user complete freedom in creating their website. You can use this to create a portfolio of your projects or showcase your designs. The possibilites are endless and the choice is yours. + +```markdown +--- +title: "Hello, world!" +type: "page" +--- + +# Projects +Keep an eye on this space for my upcoming projects +``` + +## Weights + +The `weight` attribute can be added in the markdown metadata for `post` types. We have an option in our config.toml: `params.showPostsOnHomePage` which allows you to: + +1. Show popular posts on home page if the value is set to `popular`. It sorts the all the posts by it's weight attribute in ascending order. +2. Show recent posts on home page if the value is set to `recent` +3. Do not show anything if the variable is unset or an empty string. + +## Custom Head HTML + +The goal of this feature is to give the user more control over the theme. It's functioning is very straightforward - "You can inject any HTML you want in the `
` tag" . This may seem simple at first, but it opens up a lot of possibilities. + +### Bring your own scripts + +Add your own JavaScript or CSS by putting them in the `static/` folder and importing them into your HTML. + +```toml +[params] + customHeadHTML = """ + + + """ +``` + +### Analytics + +Integration with any analytics tool: This was a personal pet peeve. User privacy is our primary concern and this meant not using Google Analytics or any of the popular tools. + +We preferred privacy friendly tools like Umami(TODO link) & fathom(TODO link), but the downside was that no theme supported them out of the box which led to either changing the theme source code or contributing supporting code to the original theme (both of which are good ways to extend the theme, but not our ideal choice) + +Giving users the freedom to add anything in the HTML via config.toml seemed like an elegant way to solve the problem. + +```toml +[params] + customHeadHTML = """ + + """ +``` + +## Syntax Highlighting + +Hugo lets you choose the color scheme for the codeblocks. You can choose from the options here: https://xyproto.github.io/splash/docs/all.html + +After choosing your theme, just update the `pygmentsStyle` attribute in config.toml. + +```toml +pygmentsStyle = "monokai" +``` + +You can read more about syntax highlighting on the [official hugo docs](TODO). + + + + + diff --git a/exampleSite/content/posts/theme-documentation-basics.md b/exampleSite/content/posts/theme-documentation-basics.md new file mode 100644 index 0000000..c6ad31d --- /dev/null +++ b/exampleSite/content/posts/theme-documentation-basics.md @@ -0,0 +1,230 @@ +--- +weight: 10 +title: "Theme Documentation - Basics" +date: 2020-03-06T21:29:01+08:00 +description: "Discover what the Hugo - gokarna theme is all about and the core-concepts behind it." +tags: ["installation", "configuration", "markdown"] +type: post +--- + +Discover what the Hugo - Gokarna theme is all about and the core-concepts behind it. +TODO: Similar intro as in README, opinionated, authors + +## 1 Requirements + +Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme. + +## 2 Installation + +The following steps are here to help you initialize your new website. If you don’t know Hugo at all, we strongly suggest you learn more about it by following this [great documentation for beginners](https://gohugo.io/getting-started/quick-start/). + +### 2.1 Create Your Project + +Hugo provides a `new` command to create a new website: + +```bash +hugo new site my_website +cd my_website +``` + +### 2.2 Install the Theme + +The theme’s repository is: [https://github.com/526avijitgupta/gokarna](https://github.com/526avijitgupta/gokarna). + +You can download the [latest release :books: .zip file](https://github.com/526avijitgupta/gokarna/releases) of the theme and extract it in the `themes` directory. + +Alternatively, clone this repository to the `themes` directory: + +```bash +git clone https://github.com/526avijitgupta/gokarna.git themes/gokarna +``` + +Or, create an empty git repository and make this repository a submodule of your site directory: + +```bash +git init +git submodule add https://github.com/526avijitgupta/gokarna.git themes/gokarna +``` + +### 2.3 Basic Configuration {#basic-configuration} + +The following is a basic configuration for the gokarna theme: + +```toml +baseURL = "http://example.org/" +defaultContentLanguage = "en" +languageCode = "en" + +title = "My New Hugo Site" + +theme = "gokarna" + +[params] + # URL for the avatar on homepage + avatarURL = "" + + # Description to display on homepage + description = "Sky above, sand below & peace within" + + # You can use this to inject any HTML in the tag. + # Ideal usecase for this is to import custom js/css or add your analytics snippet + customHeadHTML = "" + + # If you want to display posts on the homepage, the options are + # "popular" (order posts by weight), "recent" (order posts by date) + # or "" (do not display, default option) + showPostsOnHomePage = "" + + # Footer text + footer = "The Marauders" + +[menu] + [[menu.main]] + # Unique identifer for a menu item + identifier = "posts" + + url = "/posts/" + + # You can add extra information before the name (HTML format is supported), such as icons + pre = "" + + # You can add extra information after the name (HTML format is supported), such as icons + post = "" + + # Display name + name = "Posts" + + # Weights are used to determine the ordering + weight = 1 + + [[menu.main]] + identifier = "tags" + name = "Tags" + url = "/tags/" + weight = 2 + + [[menu.main]] + identifier = "github" + url = "https://github.com" + weight = 3 + + # We use feather-icons + pre = "" +``` + + +### 2.4 Create Your First Post + +Here is the way to create your first post: + +```bash +hugo new posts/first_post.md +``` + +Feel free to edit the post file by adding some sample content and replacing the title value in the beginning of the file. + +For posts you need to add `type: "post"` in the markdown metadata. We currently support 2 types of content: + +1. Post (`type: "post"`): A normal blog-post with tags, date, & content. +2. Page (`type: "page"`): A standalone content page that will just render the markdown you wrote. You can use it to write custom pages which should not be a part of posts. Like, showing your projects portfolio. You can read in detail about this on the [Theme Documentation - Advanced](/link-TODO) page. + +By default all posts and pages are created as a draft. If you want to render these pages, remove the property `draft: true` from the metadata, set the property `draft: false` or add `-D`/`--buildDrafts` parameter to `hugo` command. + +### 2.5 Launching the Website Locally + +Launch by using the following command: + +```bash +hugo serve +``` + +Go to `http://localhost:1313`. + +### 2.6 Build the Website + +When your site is ready to deploy, run the following command: + +```bash +hugo +``` + +A `public` folder will be generated, containing all static content and assets for your website. It can now be deployed on any web server. + +The website can be automatically published and hosted with [Netlify](https://www.netlify.com/) (Read more about [Automated HUGO deployments with Netlify](https://www.netlify.com/blog/2015/07/30/hosting-hugo-on-netlifyinsanely-fast-deploys/)). +Alternatively, you can use [AWS Amplify](https://gohugo.io/hosting-and-deployment/hosting-on-aws-amplify/), [Github pages](https://gohugo.io/hosting-and-deployment/hosting-on-github/), [Render](https://gohugo.io/hosting-and-deployment/hosting-on-render/) and more... + +## 3 Configuration + +### 3.1 Site Configuration {#site-configuration} + +In addition to [Hugo global configuration](https://gohugo.io/overview/configuration/) and [menu configuration](#basic-configuration), **gokarna** lets you define the following parameters in your site configuration (here is a `config.toml`, whose values are default). + +Please open the code block below to view the complete sample configuration :(far fa-hand-point-down fa-fw):: + +```toml +[params] + version = "1.0.X" + # site description + description = "This is My New Hugo Site" + # site keywords + keywords = ["Theme", "Hugo"] + # site default theme ("light", "dark", "auto") + defaultTheme = "auto" + # public git repo url only then enableGitInfo is true + gitRepo = "" + # ("sha256", "sha384", "sha512", "md5") + fingerprint = "" + dateFormat = "2006-01-02" + # website images for Open Graph and Twitter Cards + images = ["/logo.png"] + SourceMap = true + + [params.pwa] + # whether to enable PWA support + enable = true + # service-worker version + version = "1.0.1" + + [params.app] + # optional site title override for the app when added to an iOS home screen or Android launcher + title = "gokarna" + # whether to omit favicon resource links + noFavicon = false + # modern SVG favicon to use in place of older style .png and .ico files + svgFavicon = "" + # Android browser theme color + themeColor = "#ffffff" + # Safari mask icon color + iconColor = "#5bbad5" + # Windows v8-10 tile color + tileColor = "#da532c" + + [params.search] + enable = true + # type of search engine ("lunr", "algolia") + + # Header config + [params.header] + # desktop header mode ("fixed", "normal", "auto") + desktopMode = "fixed" + # mobile header mode ("fixed", "normal", "auto") + mobileMode = "auto" + [params.header.title] + # URL of the LOGO + logo = "" + rss = true +``` + +### 3.2 Favicons, Browserconfig, Manifest + +It is recommended to put your own favicons: + +* apple-touch-icon.png (180x180) +* favicon-32x32.png (32x32) +* favicon-16x16.png (16x16) +* mstile-150x150.png (150x150) +* android-chrome-192x192.png (192x192) +* android-chrome-512x512.png (512x512) + +into `/static`. They’re easily created via [https://realfavicongenerator.net/](https://realfavicongenerator.net/). + diff --git a/exampleSite/content/projects/_index.md b/exampleSite/content/projects/_index.md index a61b7bb..f25be04 100644 --- a/exampleSite/content/projects/_index.md +++ b/exampleSite/content/projects/_index.md @@ -1,6 +1,6 @@ --- title: "Projects" -type: singles +type: page --- diff --git a/exampleSite/content/projects/tatooine.md b/exampleSite/content/projects/tatooine.md index 7deb229..cf4b589 100644 --- a/exampleSite/content/projects/tatooine.md +++ b/exampleSite/content/projects/tatooine.md @@ -1,7 +1,7 @@ --- title: "Tatooine" date: 2021-05-12T23:39:49+05:30 -type: singles +type: page --- ### A long time ago in a galaxy far, far away.... diff --git a/themes/gokarna/layouts/_default/list.html b/themes/gokarna/layouts/_default/list.html index 437033d..8caf133 100644 --- a/themes/gokarna/layouts/_default/list.html +++ b/themes/gokarna/layouts/_default/list.html @@ -1,6 +1,6 @@ {{ define "main" }} - {{ if eq .Type "singles" }} - {{- partial "single.html" . -}} + {{ if eq .Type "page" }} + {{- partial "page.html" . -}} {{ else }} {{- partial "list.html" . -}} {{ end }} diff --git a/themes/gokarna/layouts/_default/single.html b/themes/gokarna/layouts/_default/single.html index 92886e9..90c6e64 100644 --- a/themes/gokarna/layouts/_default/single.html +++ b/themes/gokarna/layouts/_default/single.html @@ -3,7 +3,7 @@ {{- partial "post.html" . -}} {{ end }} - {{ if eq .Type "singles" }} - {{- partial "single.html" . -}} + {{ if eq .Type "page" }} + {{- partial "page.html" . -}} {{ end }} {{ end }} diff --git a/themes/gokarna/layouts/_default/terms.html b/themes/gokarna/layouts/_default/terms.html index 1c400fc..9019e8d 100644 --- a/themes/gokarna/layouts/_default/terms.html +++ b/themes/gokarna/layouts/_default/terms.html @@ -3,11 +3,11 @@