Skip to content

Commit

Permalink
Update/improve pagespeed (#30)
Browse files Browse the repository at this point in the history
* Add title

* Not adding google tag manager by default

* Rename config and instructions
  • Loading branch information
zetxek authored Jun 30, 2024
1 parent 1408a5c commit 8b946ed
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Note: the theme has **not** been migrated to Hugo Modules yet. To install it, yo
- Enter the newly created folder: `cd <your website's name>/`
- Install PostCSS: execute `npm i -D postcss postcss-cli autoprefixer` from the top-level site folder [check [Hugo's official docs](https://gohugo.io/hugo-pipes/postcss/)].
- Clone the adritian-free-hugo-theme: `git clone https://github.com/zetxek/adritian-free-hugo-theme.git themes/adritian-free-hugo-theme`.
- Replace the `config.toml` file in the project's root directory with themes/adritian-free-hugo-theme/exampleSite/config.toml: `cp themes/adritian-free-hugo-theme/exampleSite/config.toml hugo.toml` (*executed from the website root folder*)
- Replace the `config.toml` file in the project's root directory with themes/adritian-free-hugo-theme/exampleSite/config.toml: `cp themes/adritian-free-hugo-theme/exampleSite/hugo.toml hugo.toml` (*executed from the website root folder*)
- Start Hugo with `hugo server -D`
- 🎉 The theme is alive on http://localhost:1313/

Expand Down
File renamed without changes.
Empty file added data/config.yml
Empty file.
3 changes: 3 additions & 0 deletions data/homepage.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
head:
title: "Demo site for Adritian - a high performance hugo theme by Adrián Moreno"
description: "This hugo theme (Adritian) is based on Boostrap and has features that make it suitable for a personal site, a portfolio or other kind of Single Page Applications."
# showcase
showcase:
enable: true
Expand Down
8 changes: 7 additions & 1 deletion exampleSite/config.toml → exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ theme = "adritian-free-hugo-theme"

sections = ["showcase", "about", "education", "experience", "client-and-work", "testimonial", "contact", "newsletter"]

googleTagManagerID = "GTM-000000" # Google Analytics works with Google Tag Manager
homepageExperienceCount = 6

[params.google_analytics]
code = "UA-XXXXX-Y"
enabled = fale
[params.google_tag_manager]
code = "GTM-XXXXX"
enabled = false

[params.logo]
text1 = "Cool"
Expand Down
10 changes: 8 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<meta name="theme-color" content="#478079" >
<link rel="preconnect" href="https://www.googletagmanager.com">

{{ if .Site.Params.analytics.google_tag_manager.enabled }}
<link rel="preconnect" href="https://www.googletagmanager.com">
{{ end }}
<!-- endinject -->
<title>{{ .Site.Data.homepage.head.title }}</title>
<meta name="description" content="{{ .Site.Data.homepage.head.description }}">
Expand Down Expand Up @@ -50,8 +52,12 @@
{{- end }}
/>
</noscript>
{{ if .Site.Params.analytics.google_tag_manager.enabled }}
<!-- Google tag (gtag.js), google analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id=UA-465407-4"></script>
{{ $analytics := resources.Get "js/analytics.js" | resources.Minify }}
{{ $analytics := resources.Get "js/gtag.js" | resources.Minify }}
<script defer src="{{ $analytics.Permalink }}"></script>
{{ else }}
<!-- no google tag displayed -->
{{ end }}

5 changes: 4 additions & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!-- if you want to enable google tag manager you can check in your theme toml -->
{{ if .Site.Params.analytics.google_tag_manager.enabled }}
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id={{ .Site.Params.googleTagManagerID }}"
src="https://www.googletagmanager.com/ns.html?id={{ .Site.Params.analytics.google_tag_manager.id }}"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
<!-- End Google Tag Manager (noscript) -->
{{ end }}
<header class="header fixed-top rad-animation-group" id="header">
<div class="container rad-fade-in">
<nav class="navbar navbar-expand-lg navbar-light p-0">
Expand Down

0 comments on commit 8b946ed

Please sign in to comment.