Skip to content

Commit 1bcd624

Browse files
authored
refactor: display gitinfo and make a link, also update README (#34)
1 parent 9734d86 commit 1bcd624

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,47 @@ site.webmanifest
153153

154154
You can put these in your `static` dir and they will exist where they should when the site is built and published.
155155

156+
### Accent Colors
157+
158+
> [!CAUTION]
159+
> This should be considered a beta feature, subject to change. Not likely to be deprecated though as I quite like it.
160+
161+
You can enable this by passing `Params.accentColor = '$color'` where `$color` doesn't necessarily need to be a color, just a string, but I choose `$color`. You do you.
162+
163+
```toml
164+
[Params]
165+
accentColor = 'blue'
166+
```
167+
168+
Then in `assets/css/blue.css` **notice** whatever `blue` is here is what you pass in the `Params.accentColor` above.
169+
170+
```css
171+
@import "tailwindcss";
172+
173+
@media (prefers-color-scheme: dark) {
174+
:root {
175+
--accent-color: var(--color-sky-500);
176+
}
177+
}
178+
179+
@media (prefers-color-scheme: light) {
180+
:root {
181+
--accent-color: var(--color-blue-700);
182+
}
183+
}
184+
```
185+
186+
Since this theme uses TailwindCSS, I choose to use their color patterns, but these values (`--color-blue-700` or `--color-sky-500`) don't need to be TailwindCSS values, you could pass any supported value here.
187+
188+
### GitInfo
189+
190+
You can display the [abbreviated hash](https://gohugo.io/methods/page/gitinfo/#abbreviatedhash) by setting `enableGitInfo = true` in `hugo.toml`. Additionally, you can pass `Params.gitURL = 'https://<your git repo here>'` like so to make this has a link to the commit:
191+
192+
```toml
193+
[Params]
194+
gitURL = 'https://github.com/esacteksab/simpl'
195+
```
196+
156197
### Deploying to Cloudflare Pages
157198

158199
Hugo's documentation on [Host and deploy](https://gohugo.io/host-and-deploy/) is pretty extensive. Cloudflare also publishes a [Hugo](https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/) specific guide.

layouts/partials/footer.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@
3737
{{- end -}}
3838
<p>Built with <i class="fas fa-heart"></i> and
3939
<a class="powered-by" href="https://github.com/esacteksab/simpl" target="_blank">Simpl</a>.
40-
Powered by <a class="powered-by" href="https://gohugo.io/" target="_blank">Hugo</a>.
41-
{{- with .GitInfo }}{{ .AbbreviatedHash }}{{- end -}}
40+
Powered by <a class="powered-by" href="https://gohugo.io/" target="_blank">Hugo</a>.&nbsp;
4241
</p>
4342
</div>
43+
<div class="flex flex-col items-center invisible md:visible ">
44+
{{- if $.Site.Params.gitURL -}}
45+
<span class="text-xs">{{- with .GitInfo }}<a href="{{ $.Site.Params.gitURL}}/commit/{{ .Hash }}">[{{ .AbbreviatedHash -}}]</a>{{- end -}}</span>
46+
{{- else -}}
47+
<span class="text-xs">{{- with .GitInfo }}[{{ .AbbreviatedHash }}]{{- end -}}</span>
48+
{{- end -}}
49+
</div>
4450
{{- /* Trim EOF */ -}}

0 commit comments

Comments
 (0)