Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
Init version 2
Browse files Browse the repository at this point in the history
- Switch to the Hugo Pipes (bye bye Webpack)
- Use Inter from Google Fonts
- Update README
  • Loading branch information
panr committed Aug 8, 2020
1 parent 005e78d commit 0be3133
Show file tree
Hide file tree
Showing 74 changed files with 173 additions and 7,564 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ rules:
no-unused-vars:
- 2
- argsIgnorePattern: "^_"
# jsx a11y
jsx-a11y/no-static-element-interactions: 0
jsx-a11y/anchor-is-valid:
- 2
- specialLink:
- to

globals:
document: true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
public
8 changes: 7 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"parser": "babel",
"printWidth": 100,
"trailingComma": "all"
"trailingComma": "all",
"overrides": [{
"files": ".html",
"options": {
"parser": "html"
}
}]
}
21 changes: 21 additions & 0 deletions COMMUNITY-FEATURES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Community features

<!--
Did a cool thing with the theme and want to share it with rest of the Hello Friend theme users? Jump in!
Please follow the template:
- **NAME_OF_THE_FEATURE** (LINK TO YOUR FORK)
- SHORT DESCRIPTION
- SOMETHING ABOUT YOU (name and who you are / what you do / etc.)
eg:
- **Social media icons** (https://github.com/...)
- This was a big missing feature of the theme. It will help your audience reach you over the internet.
- John, a javascript developer.
-->

- **Social media icons** (https://github.com/...)
- This is the biggest missing feature of the theme. But now it will help your audience reach you over the internet.
- John, a javascript developer.
68 changes: 40 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

![Hello Friend](https://github.com/panr/hugo-theme-hello-friend/blob/master/images/screenshot.png?raw=true)

### DEMO - https://hugo-hello-friend.now.sh/
### DEMO - https://hugo-hello-friend.now.sh/ <a id="demo" />

<a href="https://www.buymeacoffee.com/panr" target="_blank"><img src="https://res.cloudinary.com/panr/image/upload/v1579374705/buymeacoffee_y6yvov.svg" alt="Buy Me A Coffee" ></a>

---

- [Hello Friend](#hello-friend)
- [DEMO - https://hugo-hello-friend.now.sh/](#demo---httpshugo-hello-friendnowsh)
- [DEMO - https://hugo-hello-friend.now.sh/](#demo)
- [Features](#features)
- [Built-in shortcodes](#built-in-shortcodes)
- [Code highlighting](#code-highlighting)
- [Improved RSS Feed](#improved-rss-feed)
- [How to start](#how-to-start)
- [How to run your site](#how-to-run-your-site)
- [How to configure](#how-to-configure)
- [How to add a cover image to your posts](#how-to-add-a-cover-image-to-your-posts)
- [How to display the Last Modified Date in your posts](#how-to-display-the-last-modified-date-in-your-posts)
- [How to hide "Read more" button](#how-to-hide-read-more-button)
- [Add-ons](#add-ons)
- [How to run your site](#how-to-run-your-site)
- [How to edit the theme](#how-to-edit-the-theme)
- [How to contribute](#how-to-contribute)
- [How to (safely) edit the theme](#how-to-edit)
- [Found a bug?](#bug)
- [New cool idea or feature](#feature)
- [`Hello Friend` theme user?](#hello-friend-theme-user)
- [Sponsoring](#sponsoring)
- [License](#license)
Expand Down Expand Up @@ -107,6 +108,24 @@ If you don't want to make any radical changes, it's the best option, because you
$ git submodule add https://github.com/panr/hugo-theme-hello-friend.git themes/hello-friend
```

## How to run your site

The theme is using [Hugo Pipes](https://gohugo.io/hugo-pipes/) to handle Javascript and PostCSS files. This setup **requires** following npm packages:

```
@babel/cli @babel/core @babel/preset-env browserslist clipboard cssnano postcss-cli postcss-import postcss-mixins postcss-nested postcss-preset-env postcss-url
```

Before you start, you have to install them (globally or locally).

Then:

```
$ hugo server -t hello-friend
```

and go to `localhost:1313` in your browser. From now on all the changes you make will go live, so you don't need to refresh your browser every single time.

## How to configure

The theme doesn't require any advanced configuration. Just copy:
Expand Down Expand Up @@ -210,37 +229,30 @@ In a post's front matter you have to add `hideReadMore` param set to `true`. Thi
- **Extended `<head>`** — if you need to add something inside `<head>` element, after all of all of the theme's `<script>` and `<link>` tags are declared, please take a look at `layouts/partial/extended_head.html` https://github.com/panr/hugo-theme-hello-friend/blob/master/layouts/partials/extended_head.html
- **Extended `<footer>`** — if you need to add something before end of `<body>` element, please take a look at `layouts/partial/extended_footer.html` https://github.com/panr/hugo-theme-hello-friend/blob/master/layouts/partials/extended_footer.html

## How to run your site
## How to (safely) edit the theme <a id="how-to-edit" />

From your Hugo root directory run:
To change something in the theme, you have to go to `themes/hello-friend` and modify the files. You can also copy them (like `assets` folder) from the theme to your root directory and modify the files there (thanks to Hugo's lookup https://gohugo.io/templates/lookup-order). This will protect your changes from overriding when you update the theme.

```bash
$ hugo server -t hello-friend
```
## Found a bug? <a id="bug" />

and go to `localhost:1313` in your browser. From now on all the changes you make will go live, so you don't need to refresh your browser every single time.
If you spot any bugs, please use [Issue Tracker](https://github.com/panr/hugo-theme-hello-friend/issues) or create a new [Pull Request](https://github.com/panr/hugo-theme-hello-friend/pulls) to fix the issue.

## How to edit the theme
## New cool idea or feature? <a id="feature" />

If you have to override some of the styles, you can do this easily by adding `static/style.css` in your root directory and point things you want to change.
The theme is in constant development since 2019 and has got many cool features that helped many of you and made the theme better. But there were also many features that I wasn't sure about because I want to keep the theme as simple as possible.

Otherwise, if you really want to edit the theme, you need to install Node dependencies. To do so, go to the theme directory (from your Hugo root directory):
So, let's say you have an idea of how to extend the theme. That's cool and you're welcome to do that, just follow these steps:

```bash
$ cd themes/hello-friend
```

and then run:

```bash
$ npm install
$ npm i yarn
$ yarn
```
- fork the theme
- implement the feature
- write an instruction how to use the feature
- give a working example of the implementation for other users
- add info about your work to `COMMUNITY-FEATURES.md`
- make a PR with edited `COMMUNITY-FEATURES.md`

## How to contribute
This will help keeping the theme close to its roots, and also allow anyone who wishes to improve it and match their needs, to do whatever they want.

If you spot any bugs, please use [Issue Tracker](https://github.com/panr/hugo-theme-hello-friend/issues) or if you want to add a new feature directly please create a new [Pull Request](https://github.com/panr/hugo-theme-hello-friend/pulls).
Sounds OK? Cool, let's rock! 🤘

## `Hello Friend` theme user?

Expand All @@ -254,6 +266,6 @@ If you like my work and want to support the development of the project, now you

## License

Copyright © 2019 Radosław Kozieł ([@panr](https://twitter.com/panr))
Copyright © 2019-2020 Radosław Kozieł ([@panr](https://twitter.com/panr))

The theme is released under the MIT License. Check the [original theme license](https://github.com/panr/hugo-theme-hello-friend/blob/master/LICENSE.md) for additional licensing information.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 17 additions & 3 deletions source/css/main.css → assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ body {
padding: 0;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", Helvetica, Arial, sans-serif;
font-size: 1rem;
font-weight: 600;
font-weight: 500;
font-feature-settings: "liga", "tnum", "case", "calt", "zero", "ss01", "locl";
line-height: 1.54;
background-color: var(--background);
color: var(--color);
Expand Down Expand Up @@ -124,14 +125,20 @@ figure {
}
}

code {
code, kbd {
font-family: Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;
background: var(--background-secondary);
padding: 1px 6px;
margin: 0 2px;
border-radius: 5px;
font-size: .9rem;
font-weight: normal;

code, kbd {
background: transparent;
padding: 0;
margin: 0;
}
}

pre {
Expand All @@ -151,7 +158,7 @@ pre {
color: #ccc;
margin: 0;
padding: 0;
font-size: .9rem;
font-size: inherit;
}
}

Expand Down Expand Up @@ -243,3 +250,10 @@ hr {
.hidden {
display: none;
}

.framed {
padding: 20px;
border-radius: 10px;
border: 1px solid var(--border-color);
max-width: 800px;
}
2 changes: 1 addition & 1 deletion source/css/menu.css → assets/css/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
border-right: 1px solid;
margin-right: 18px;
padding-right: 24px;
font-weight: 600;
font-weight: 500;

@media (--phone) {
@mixin menu;
Expand Down
2 changes: 1 addition & 1 deletion source/css/pagination.css → assets/css/pagination.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
justify-content: center;
background: var(--background-secondary);
font-size: 1rem;
font-weight: 600;
font-weight: 500;
border-radius: 8px;
max-width: 40%;
padding: 0;
Expand Down
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@import 'fonts.css';
@import 'variables.css';
@import 'buttons.css';

@import 'header.css';
@import 'logo.css';
@import 'menu.css';
@import 'main.css';
@import 'post.css';
@import 'pagination.css';
@import 'footer.css';

@import 'terms.css';
@import 'archive.css';

@import 'prism.css';
@import 'code.css';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = function(api) {
api.cache(true);

const presets = [
[
"@babel/preset-env",
{
targets: "last 2 versions, >1%, not dead",
},
],
];
const plugins = [];

return {
presets,
plugins,
};
};
10 changes: 8 additions & 2 deletions layouts/_default/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}

{{ if .Content }}
<div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
{{ .Content }}
</div>
{{ end }}

<div class="posts">
{{ range $paginator.Pages }}
<div class="post on-list">
Expand Down Expand Up @@ -39,9 +45,9 @@ <h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Params.Cover }}
<figure class="post-cover">
{{ if .Params.UseRelativeCover }}
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" />
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}"/>
{{ else }}
<img src="{{ .Params.Cover | absURL }}" />
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}"/>
{{ end }}

{{ if .Params.CoverCaption }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ <h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Params.Cover }}
<figure class="post-cover">
{{ if .Params.UseRelativeCover }}
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" />
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}" />
{{ else }}
<img src="{{ .Params.Cover | absURL }}" />
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}" />
{{ end }}

{{ if .Params.CoverCaption }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ <h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Params.Cover }}
<figure class="post-cover">
{{ if .Params.UseRelativeCover }}
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" />
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" alt="{{ .Title | plainify | default " " }}" />
{{ else }}
<img src="{{ .Params.Cover | absURL }}" />
<img src="{{ .Params.Cover | absURL }}" alt="{{ .Title | plainify | default " " }}" />
{{ end }}

{{ if .Params.CoverCaption }}
Expand Down
10 changes: 8 additions & 2 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
</div>
</footer>

<script src="{{ "assets/main.js" | absURL }}"></script>
<script src="{{ "assets/prism.js" | absURL }}"></script>
{{ $opts := dict "noComments" true "minified" true "compact" true }}
{{ $menu := resources.Get "js/menu.js" | js.Build | babel $opts }}
{{ $theme := resources.Get "js/theme.js" | js.Build | babel $opts }}
{{ $prism := resources.Get "js/prism.js" | js.Build | babel $opts }}
<script src="{{ $menu.Permalink }}"></script>
<script src="{{ $theme.Permalink }}"></script>
<script src="{{ $prism.Permalink }}"></script>

{{- partial "extended_footer.html" . }}
5 changes: 4 additions & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
{{- partial "prepended_head.html" . }}

<!-- Theme CSS -->
<link rel="stylesheet" href="{{ "assets/style.css" | absURL }}">
{{ $css := resources.Get "css/style.css" }}
{{ $opts := dict "inlineImports" true }}
{{ $style := $css | resources.PostCSS $opts | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">

<!-- Custom CSS to override theme properties (/static/style.css) -->
<link rel="stylesheet" href="{{ "style.css" | absURL }}">
Expand Down
Loading

0 comments on commit 0be3133

Please sign in to comment.