1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-01 02:13:00 +01:00
Commit Graph

132 Commits

Author SHA1 Message Date
DeedleFake
d0c9781d74 Add Permalink as prefix to back to top link href. (#22) 2016-11-29 17:07:28 +02:00
b52fac69b1
layouts: retab after addition of modelines
Done in vim using `gg=G` and then `:retab`.
2016-11-24 14:39:39 +02:00
DeedleFake
663f3db2a0 Add Vim Modeline Comments to Files (#18)
* Add Vim modeline comments to all relevent template files.

* Add Vim modeline comments to a few other files.

* Move modeline comments inside the template definitions in list and single.

For some odd reason, putting them outside breaks the page generation.

* Use template comments for modeline comments in templates.

* Fix form 2 modelines.
2016-11-24 14:33:56 +02:00
DeedleFake
b83b1683a7 Add ability to insert custom code into the global <head>. (#17)
* Add ability to insert custom code into the global <head>.
* Fix indentation.
2016-11-22 21:11:50 +02:00
abfc8ad15c
Make "→" in "Read more" part of the i18n strings
Eventually I'd like to support right-to-left languages like Arabic
and we'd need the arrow to point the other way for that.
2016-11-20 12:14:46 +02:00
Rassie Smit
aa7bd11522 Add custom navbar support
- default behaviour is backward compatible: all non-post pages
- optionally enable custom navbar using hugo menu functionality
2016-11-17 10:04:14 +00:00
Bjørn Erik Pedersen
a6ebe0a0b3 Rename RSSlink to RSSLink
The former will be deprecated and eventually removed from Hugo.

Note: Currently both of them exist in Hugo, which is the reason for the cleanup.
2016-11-17 09:12:17 +01:00
a66be324cc
Add plumbing for cookie consent
Set the cookie_consent_info_url parameter in your site's config to
display a message about cookie usage to your users. See the config
in `exampleSite/config.toml` for more info.
2016-11-13 14:13:17 +02:00
1f14455b12
layouts/_default/baseof.html: Don't indent go blocks
They get indented doubly in the generated HTML and look funny.
2016-11-09 15:42:39 +02:00
929d2d976a
layouts/_default/baseof.html: Improve handling of RSS
We are explicitly using the site's RSS feed, but after reading the
Hugo RSS docs I think it's better if we use the contextual version
of the RSSlink. This will make the RSS plumbing show a feed for the
current category, tag, section, etc. The example code also adds a
bit of markup to help browsers find the content more easily.

See: https://gohugo.io/templates/rss/
2016-11-09 15:39:23 +02:00
Frank Tegtmeyer
b81d5c54da Disqus integration for single nodes. 2016-11-01 15:25:44 +01:00
9d4d062152
layouts/_default/baseof.html: Remove optional sidebar hiding
As it is right now, the sidebar gets hidden but the blog's main
content stays on the left. Gotta look at the CSS to make the
container responsive.
2016-10-18 23:06:19 -04:00
2abe8b1cd3
layouts/_default/list.html: Only show pagination if necessary 2016-10-18 22:53:14 -04:00
cdcae6c8a4
layouts: Don't assume date_format is defined
User can override the date format with date_format, but we should
have a default in the case that the user hasn't defined it.
2016-10-17 23:39:41 -04:00
b637dd5eb1
layouts/partials/head-meta.html: Use Hugo's templates
Instead of writing my own logic for metadata and Twitter cards, I
should be using Hugo's own. This makes my theme code cleaner, but
means I have to adjust some of the configuration conventions that
I have been using. An added bonus is that my theme will work with
more sites now, as long as they are using Hugo's config conventions.
2016-10-14 23:07:39 -04:00
c49fa721ec
layouts/_default/baseof.html: Add support for Google Analytics
Sites only need to add their Google Analytics tracking ID to their
config:

  googleAnalytics = "UA-123-45"

This uses the async version of the Google Analytics code.
2016-10-14 22:10:01 -04:00
6e84974d2a
layouts/_default/baseof.html: Add "back to top" link in footer 2016-10-09 13:45:38 +03:00
142d330048
layouts/_default/baseof.html: Give credit to @mdo for theme 2016-10-09 13:38:49 +03:00
77b2cf9955
layouts/_default/baseof.html: Allow configuration of footer text
Uses the "copyright" parameter from the site's config that is pretty
standard among Hugo themes. Content can contain Markdown.
2016-10-09 13:36:07 +03:00
7194b5926d
layouts/partials/head-meta.html: Add site verification support
I had added Google Webmaster verify support but it got lost when I
was re-organizing the head meta stuff. I'm adding it back now plus
support for Bing and Yandex.
2016-10-08 16:57:10 +03:00
577fdd75ce
layouts/_default/single.html: Markdownify page title
In a multilingual context a post's title could be "Title" in English
but «Title» in Bulgarian, and if we apply the Markdown filter to the
title tag, then the language's Black Friday configuration is used,
in this example it would be for the angled quotes.

We already do this everywhere else we can in the post's content, so
let's match it in the page title.
2016-10-06 15:05:44 +03:00
d6328c34df
Remove anchor titles
I had only added these for accessibility, but after some research
it seems that assistive technologies don't use these.
2016-10-06 14:21:30 +03:00
3a6bed5be7
layouts: Use Markdown filter on titles
This makes it possible to have Black Friday config options like
quote style also affect post titles.
2016-10-06 14:17:59 +03:00
36a8a28d4c
layouts/_default/list.html: Remove debug code from pagination 2016-10-05 17:28:08 +03:00
a8d694d08c
Add pagination logic + i18n strings for en 2016-10-05 17:21:53 +03:00
70b4844c63
layouts/_default/list.html: Use paginator for page lists instead of custom stuff
Hugo's own pagination stuff works just as well and probably covers
even more corner cases. Also, this is one less config variable to
have to check because you can just use Paginate (Default: 10).
2016-10-05 15:45:38 +03:00
98a8c2b234
layouts/_default/baseof.html: Use template variable for RSS link
This is the whole site's RSS feed, not just posts. I suppose this
is better for multilingual sites, and sites with many pages.
2016-10-05 15:31:30 +03:00
f873452e6c
layouts/_default/baseof.html: Use current language for html element's lang attribute
You know you gotta specify the page content's language if possible,
right?

https://www.w3.org/International/questions/qa-http-and-lang
2016-10-04 11:22:53 +03:00
577e168da5
Use i18n to translate some strings
Hugo 0.17 allows for easy multi-lingual sites. Strings can be
translated either in the theme or in the site, and missing strings
will fall back to the default language.

See: https://github.com/spf13/hugo/blob/master/docs/content/content/multilingual.md
2016-10-03 22:58:22 +03:00
d99cf5df11
layouts/partials/meta-terms.html: use relLangURL for categories/tags
Fixes generation of links to language-specific tags.
2016-10-03 22:28:35 +03:00
1a3ff61ef6
layouts/_default/single.html: Add basic support for multi-language content
Hugo 0.17 will allow you to write content and user interface strings
in multiple languages. Requires the user to amend their config a
bit though.

See: https://github.com/spf13/hugo/blob/master/docs/content/content/multilingual.md
2016-10-03 17:57:08 +03:00
48a6a82dcc
layouts/_default/summary.html: Remove extraneous spaces 2016-09-27 23:22:46 +03:00
d16fe216a5
layouts: Remove link from author name in summary/posts
There is no author archive yet, so this link doesn't go anywhere!
2016-09-27 23:21:01 +03:00
6a25f3eef1
layouts: Move all meta tags to head-meta.html partial 2016-09-26 09:26:00 +03:00
71413f55b6
layouts: Rename metadata partial 2016-09-26 09:23:13 +03:00
884713fc2a
layouts: Add theme support for categories and tags
Add categories/tags to front matter and they will be displayed on
summary and post pages, with links to taxonomy pages. Example:

  +++
  date = "2016-09-24T21:28:31+03:00"
  title = "Post title"
  categories = ["Nature"]
  tags = ["Wetland", "Oasis"]
  +++

For some reason if you add tags singularly, like:

  categories = "Nature"

you get index errors from Hugo. Not sure if I need to parse the
tags differently or just add more logic to test if the terms are
singular or not.
2016-09-26 08:32:46 +03:00
acde63b34f
layouts/_default/baseof.html: Make sidebar logic more robust
Check if the params.sidebar is defined before checking to see if
params.sidebar.hide is true or false. New sites might not have
their config set up properly, so this avoids an error in the case
that params.sidebar isn't defined yet.
2016-09-22 09:19:20 +03:00
d6d94ff087
Add robots.txt template
Advertises the XML sitemap and allows all user agents, but is only
enabled if the site sets this property in their config:

  enableRobotsTXT = true

See: https://gohugo.io/extras/robots-txt/
2016-09-21 22:37:39 +03:00
9bb8294089
Add RSS feed for posts to base layout
Not sure who uses RSS anymore but Hugo automatically generates the
feed so we might as well advertise it.
2016-09-19 10:00:28 +03:00
72d5c94cc5
Add basic sharing icons to the bottom of posts
By default they are on, but you can disable them by adding the
following configuration value:

  [params.sharingicons]
    hide = true

If this parameter is undefined (or "false") then the icons will be
shown. Furthermore, you can disable specific icons by setting their
value to "false", ie:

  [params.sharingicons]
    facebook = false

Any icons not named will be shown. Currently there a four icons
configureg: facebook, googleplus, linkedin, and twitter.
2016-09-18 17:11:08 +03:00
731af8c564
layouts: Add basic support for OpenGraph and Twitter card metadata
Uses basic data like title, description, author, and date that we
are using with existing vanilla meta tags, but extends them to OG
and Twitter Card tags. See [0] and [1].

For the Twitter summary cards specifically, you can optionally add
attribution for your username by adding something like this to your
configuration:

  [params.social]
    twitter_username = "@mralanorth"

... and for posts with images, you can specify an "image" in the
post's front matter like so:

  image = "/2016/09/IMG_20160916_174409.jpg"

And then the theme will opt to use Twitter's "large" summary card.

[0] http://ogp.me/
[1] https://dev.twitter.com/cards/getting-started
2016-09-17 18:05:22 +03:00
826bd2de54
layouts/partials/sidebar.html: Use "Type" instead of "Section"
Both work similarly here, but "Type" is more obvious to me.
2016-09-17 16:56:27 +03:00
4427040041
layouts/_default/baseof.html: Enumerate non-post pages in header nav menu
Still need to figure out how to determine which page we're on so we
can set the "active" class accordingly (for Home we have the IsHome
variable the we can check).
2016-09-14 23:43:26 +03:00
d31626c5a3
layouts/_default/list.html: Check for page type instead of "section"
Both work effectively the same for my use case, but the "type" is
more obvious when looking at the code. See the documentation for
Hugo's page variables for more info[0].

[0] http://gohugo.io/templates/variables/#page-variables
2016-09-14 23:39:39 +03:00
42c06c260c
layouts: Only list posts on front page and sidebar
We don't want to list other top-level pages like "About" here, they
will be enumerated in the header.
2016-09-14 16:35:04 +03:00
2bb9509bbb
layouts/_default/baseof.html: Add "active" class to nav if page is home
Not sure how to do this for other pages yet, but I'll solve that
once I start enumerating pages into the nav.
2016-09-14 14:55:29 +03:00
e8ee0c68b7
layouts/_default/baseof.html: Smarter meta author tag
Use the post's author from frontmatter, or else use the author from
the site's config. You MUST have one of these set or else you will
get an error during site generation. I think it's better to force
the user to define an author tag rather than only printing it if
it is defined because it is a good practice to help bots understand
content.
2016-09-14 14:05:36 +03:00
c5bacecad6
layouts/_default/baseof.html: Smarter meta description
Use the post's meta description if it exists, otherwise use the
one from the site's config. Set them using the "description" key
in frontmatter or site config.

Note: this means there is no way to NOT have a description. You
must have *at least* a site-wide description and *optionally* a
description for each page/post's front matter.
2016-09-14 13:45:34 +03:00
cd3e327553
layouts: Use HTML5-compatible datetime format for posts
The W3C validator was complaining.

See: https://validator.w3.org
See: https://html.spec.whatwg.org/multipage/semantics.html#the-time-element
2016-09-14 13:12:27 +03:00
8c4b423173
layouts/_default/summary.html: Fix W3C validation error
The validator[0] says:

  Element nobr not allowed as child of element a in this context.

... so I'll just remove it.

[0] https://validator.w3.org
2016-09-14 12:39:40 +03:00
d37e111ff4
Adjust header levels for post summary and page
The W3C's HTML5 documentation says that header strength (h1–h6) is
only important per section, but their validator[0] recommends only
using one h1.

[0] https://validator.w3.org/
2016-09-14 12:28:15 +03:00
c94335a193
Make site header text clickable (to home)
This is a pretty standard convention in blogs.
2016-09-14 12:24:38 +03:00
2bb33145db
Allow optional addition of Google Webmaster Tools verification string
Add to the site's configuration like so:

  [params]
  google_verify_meta = "BAi69DROASu2b2mkVNA_EyUsobfH7Mq8BmSg2Rn-Zp4"
2016-09-13 16:26:30 +03:00
192d0bbee6
Allow configuration of optional sidebar links
Add something like the following to your config:

  [[menu.sidebar]]
    name = "Link 1"
    url = "https://link1.com"

  [[menu.sidebar]]
    name = "Link 2"
    url = "https://link2.com"

See the Hugo docs for more examples: https://gohugo.io/extras/menus/
2016-09-08 15:00:23 +03:00
d214834089
Allow configuration of recent posts on sidebar
By default it shows the latest five posts, but you can set this
property in your config to override it:

  [params.sidebar]
    num_recent_posts = 7

Still no way to disable it, as I don't understand golang's HTML
templating stuff yet. The Hugo docs are a bit confusing, but it
seems like conditionals are a bit tricky because both false and
0 return a boolean false... hmm.

See: https://gohugo.io/templates/go-templates/
2016-09-07 23:54:55 +03:00
ba25b91d94
Allow site description to be Markdown 2016-09-07 16:47:59 +03:00
15a41a86a2
Allow optional configuration of "About" block in sidebar
Add something like the following to your config to enable the about
block in the sidebar:

  [params.sidebar]
    about = "*My site* is really cool. Adios!"

Can be formatted in Markdown.
2016-09-07 16:41:04 +03:00
f7b4f0a819
Allow configuration of how many posts to show on the homepage
You can set this property in your site's config to override:

  [params]
  num_recent_posts = 7

Defaults to five (5) if unset.
2016-09-03 20:21:40 +03:00
a942707278
Remove static archives from sidebar
I need to figure out how to generate a list of posts grouped by
month, ie "August 2016", as well as a list template to show the
posts for each month for when the user clicks the link.
2016-09-03 19:15:09 +03:00
47b200578e
Use HTML5 header tag for blog header
Makes it easier for computers to understand content by using tags
that have explicit meaning.

See: http://diveinto.html5doctor.com/semantics.html
2016-09-02 15:56:40 +03:00
6059f6cbea
Use HTML5 aside and section tags for sidebar
The HTML5 aside tag is for content that is tangentially related to
the content around the aside tag, but is considered separate from
that content. Section tags are semantic HTML5 elements that inform
computers about content structure, as opposed to div tags which
can be used for structure OR style.

See: http://diveinto.html5doctor.com/semantics.html
2016-09-02 10:18:18 +03:00
1f0799b9f1
Use H1 headers in <article> sections
Headers are a semantic element that help computers understand the
content. In general, header tags should follow rank order, but the
most important is that the first header inside a section will serve
as the title in a table of contents, etc, but since article sections
stand alone as independent documents, I like the idea of explicitly
starting with H1 tags.

See: http://diveinto.html5doctor.com/semantics.html
2016-09-02 10:12:36 +03:00
54ba5518d2
Use HTML5 <header> tags in articles
The HTML5 <article> tag represents a complete, or self-contained,
composition in a document. Headers are a semantic HTML5 element
that helps computers understand the content.
2016-09-02 10:09:17 +03:00
9b9226ca99
Use "|" for title separator instead of ndash
A survey of a handful of websites shows that this is a more common
separator of article and site title than the ndash.
2016-09-01 23:08:39 +03:00
412cc18cf9
Start using Go 1.6's blocks
Partials are nice, but blocks are a better base construct. Right
now there is basically only layouts/_default/baseof.html that is
doing most of the work.

See: https://gohugo.io/templates/blocks
2016-09-01 17:37:27 +03:00
3042101003
Use H2 for blog post heading
I think this should be an H1 since it's in a standalone article tag
but for some reason WordPress' latest themes use an H2, so I'll use
one too until I go read the W3C docs.
2016-08-30 22:45:30 +03:00
e4cd676f3a
Reorganize summary and single post layouts
Now shows blog posts on their target page.
2016-08-30 12:45:13 +03:00
0e54dba17a
layouts/post/summary.html: Rework author name display
Use author name from frontmatter if it exists, otherwise use the
author from the site config.
2016-08-30 12:31:32 +03:00
8a0716d236
Use site author for post attribution 2016-08-30 12:07:43 +03:00
4c68cf71b0
Move summary layout to posts
The only content type we have is posts, so the summary type should
be there.
2016-08-30 11:39:03 +03:00
4043f1b1f4
Use site title in header, not context's title
Depending on the context the ".Title" could be the post or page's
title, but here we actually want the site's title.
2016-08-30 00:39:48 +03:00
d0fa547c10
Add basic single template for post type 2016-08-30 00:39:13 +03:00
a686a7636a
layouts/index.html: Adjust indentation 2016-08-30 00:33:57 +03:00
fb9376d24b
layouts: Move _default/single.html template to post archetype
For now the only singles we need are posts, so it makes sense to
move this there. I can make another single template for pages later.
2016-08-30 00:33:06 +03:00
b164ceb53c
Add common HTML tags to head and footer so we can re-use them 2016-08-30 00:31:01 +03:00
ea1da4a69e
Use HTML5 article tag for blog post summaries
See: https://developer.mozilla.org/en/docs/Web/HTML/Element/article
2016-08-29 16:24:14 +03:00
bfaa9ac247
layouts: Allow hiding the sidebar
Set the following parameter to hide the sidebar:

  [params.sidebar]
    hide = true
2016-08-28 23:41:34 +03:00
6ccdf9a438
layouts: Allow specifying number of "Recent Posts" to display in the sidebar
Set the following param in your config:

  [params.sidebar]
    num_recent_posts = 5

Alternatively, delete or comment out the variable to disable showing
of recents. I should probably allow setting it to "0" to disable.
2016-08-28 22:45:51 +03:00
72d8ffd7e3
layouts: Add indentation to sidebar 2016-08-28 22:41:52 +03:00
f76b5a069a
layouts: Improve usage of datetime
Use the date format from the config, and print it in a time tag.

See: https://golang.org/pkg/time/
2016-08-28 22:15:16 +03:00
8b7d70e3c0
Remove js libraries
I'm not actually using anything that needs jQuery or Bootstrap's
JS yet.
2016-08-28 22:11:45 +03:00
2bb1d6ecc0
First commit with initial theme
Some file are empty (created by `hugo new theme`), but I've left
them for reference later.
2016-08-28 16:22:32 +03:00