Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds i18n support to the theme #49

Merged
merged 11 commits into from
Jun 2, 2019
Prev Previous commit
Next Next commit
Added Basin example config to example site and README
  • Loading branch information
tomanistor committed Apr 15, 2018
commit 61c3bfbcf2e81b813c56d8dfeda7c76d922fe469
64 changes: 41 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
![Logo](https://github.com/tomanistor/osprey/blob/master/images/osprey-logo.png)

# Osprey

Osprey is a simple, clean, and fast one-page [Hugo](https://gohugo.io/) portfolio accompanied by a blog.

## Features
* Minimalist, clean, and uncluttered theme
* Portfolio display gallery
* [Disqus](https://disqus.com) comments
* [Formspree](https://formspree.io) AJAX contact form
* Responsive Flexbox Grid
* [SASS](http:https://sass-lang.com/) styling
* Minimized/compressed CSS and JavaScript files with cachebusting hash setup
* Syntax highlighting with [Highlight.js](https://highlightjs.org/)
* SEO-friendly construction
* [Google Analytics](https://analytics.google.com) and [Google Tag Manager](https://tagmanager.google.com) integration
* [OpenGraph](http:https://ogp.me/) and [Twitter Cards](https://dev.twitter.com/cards/overview) integration
* Quick loading speeds
* Custom CSS

- Minimalist, clean, and uncluttered theme
- Portfolio display gallery
- [Disqus](https://disqus.com) comments
- [Formspree](https://formspree.io) AJAX contact form
- Responsive Flexbox Grid
- [SASS](http:https://sass-lang.com/) styling
- Minimized/compressed CSS and JavaScript files with cachebusting hash setup
- Syntax highlighting with [Highlight.js](https://highlightjs.org/)
- SEO-friendly construction
- [Google Analytics](https://analytics.google.com) and [Google Tag Manager](https://tagmanager.google.com) integration
- [OpenGraph](http:https://ogp.me/) and [Twitter Cards](https://dev.twitter.com/cards/overview) integration
- Quick loading speeds
- Custom CSS

## Screenshot

![Screenshot](https://github.com/tomanistor/osprey/blob/master/images/tn.png)

## Installation

### Option 1: Clone Repository

In the root of your Hugo site directory run:

```console
Expand All @@ -32,6 +36,7 @@ $ git clone https://github.com/tomanistor/osprey.git
```

### Option 2: Create Submodule

Create a submodule linked directly to the theme's GitHub repository in order to receive updates:

```console
Expand All @@ -45,6 +50,7 @@ $ git submodule update --init --recursive --remote
```

## Configuration

Osprey comes with several configuration options to aid in site customization. This is an example config.toml file:

```toml
Expand Down Expand Up @@ -79,7 +85,9 @@ disableKinds = ["taxonomy", "taxonomyTerm"] # This theme does not currently use
customCSS = false
cacheBustCSS = false
cacheBustJS = false
ajaxFormspree = true
# Choose either Formspree contact form or Basin contact form
ajaxFormspree = false
ajaxBasin = "https://usebasin.com/f/0eae7044d4c2"

[[menu.main]]
name = "About"
Expand All @@ -100,23 +108,27 @@ disableKinds = ["taxonomy", "taxonomyTerm"] # This theme does not currently use
```

## Using Osprey

The two main content types are blog posts and gallery images.

### About Section

To create an about section that renders on the home page, run:

```console
$ hugo new about.md
```

### Blog Posts

To create a new blog post, run:

```console
$ hugo new blog/post-title.md
```

### Gallery Images

To add a new image to your portfolio, run:

```console
Expand All @@ -138,25 +150,28 @@ link2 = "https://github.com/tomanistor"
```

### Contact Form

The email address specified in the config.toml file will be one receiving messages sent through the contact form. The contact form is operated by Formspree and requires that the form must be submitted once initially to confirm the email address being used. See instruction [here](https://formspree.io/).

### Contact Form Troubleshooting
If you have problems with the contact form (doing nothing on submit, seems Formspree ajax implementation works only for paid users), just create a copy of `osprey/layouts/partials/body-bottom.html` file inside `your-site/layouts/partials` and remove or comment lines 4 to 8.

If you have problems with the contact form (doing nothing on submit, seems Formspree ajax implementation works only for paid users), just create a copy of `osprey/layouts/partials/body-bottom.html` file inside `your-site/layouts/partials` and remove or comment lines 4 to 8.

Should look like this.
```
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ if .IsHome }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "index.js" }}{{ else }}index.min.js{{ end }}" type="text/javascript"></script>
{{ else }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "main.js" }}{{ else }}main.min.js{{ end }}" type="text/javascript"></script>
{{ end }}
```

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ if .IsHome }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "index.js" }}{{ else }}index.min.js{{ end }}" type="text/javascript"></script>
{{ else }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "main.js" }}{{ else }}main.min.js{{ end }}" type="text/javascript"></script>
{{ end }}

That will override the original osprey body-bottom.html and remove the ajax script. Now you can receive messages through your contact form without any problem.

PD: This will add an extra step to the contact form, on submitting the user need to fill a captcha before sending the message.

### Custom CSS

To implement custom CSS sitewide, change the config.toml parameter `customCSS` from `false` to `true` and then create a `css.html` file in your `layouts/partials/` folder like the example below:

```html
Expand All @@ -171,10 +186,13 @@ To implement custom CSS sitewide, change the config.toml parameter `customCSS` f
This will render inline CSS in the head of your site and without adding an extra HTTP request.

### Cache Busting

To implement cache busting of CSS and JS static assets with something like Gulp.js and [gulp-hash](https://www.npmjs.com/package/gulp-hash), change the config.toml parameters `cacheBustCSS` and `cacheBustJS` from `false` to `true` and follow [this setup guide](http:https://danbahrami.io/articles/building-a-production-website-with-hugo-and-gulp-js/#building-a-gulp-pipeline:c9938300a3bdba2018b469c2485ca2b6).

## Contributions

If you'd like to help with the development of this theme, I encourage you to submit a pull request or create an issue if you find a bug. All help is appreciated.

## License

This theme is released under the GNU 3.0 license. For more information read the [license](https://github.com/tomanistor/osprey/blob/master/LICENSE).
4 changes: 3 additions & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ disableKinds = ["taxonomy", "taxonomyTerm"] # This theme does not currently use
customCSS = false
cacheBustCSS = false
cacheBustJS = false
ajaxFormspree = true
# Choose either Formspree contact form or Basin contact form
ajaxFormspree = false
ajaxBasin = "https://usebasin.com/f/0eae7044d4c2"

[[menu.main]]
name = "About"
Expand Down