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

55 Commits

Author SHA1 Message Date
63241061dd
layouts/_default/baseof.html: Fix comment about RTL
It's not just Arabic anymore now that I added Farsi strings!
2020-01-23 19:46:21 +02:00
44e8c677a6
Use Hugo's built-in subresource integrity support
We can use Hugo's built-in SRI support instead of using our custom
SRI generator script (as cool as it was at the time). This is more
clean and gives us the added benefit of adding fingerprints to the
CSS and JS filenames, which acts as a cache buster.

See: https://gohugo.io/hugo-pipes/introduction/
See: https://github.com/alanorth/hugo-theme-bootstrap4-blog/issues/120
2020-01-23 19:34:21 +02:00
b2ea655810
layouts: Use right-to-left text for Farsi 2019-12-04 09:56:41 +02:00
Paweł Hofman
92cab738dd Fixed invalid URL if blog is not in domain root 2019-10-11 11:06:23 +03:00
TommySprat
8da12539f3 Support baseurl without trailing slash 2019-06-04 00:26:09 +02:00
9934368215
layouts: Set dir="auto" on some HTML elements
When a site is rendered in Arabic the root HTML element gets the
dir="rtl" attribute, but even Arabic sites might have an English
title or footer, etc so we should set dir="auto" on those elements.
2019-04-18 23:38:53 +03:00
6a3bdc53fd
Add right-to-left version of CSS
This uses rtlcss to make a right-to-left version of the CSS and then
utilizes Hugo's Language variable to conditionally include it. Also,
we set the "dir" attribute on the HTML tag if the currently rendered
language is Arabic.
2019-04-18 22:19:42 +03:00
2916229d28
layouts: Update for Hugo 0.55.0
See: https://github.com/gohugoio/hugo/releases/tag/v0.55.0
2019-04-14 16:25:35 +03:00
Cosmin Humeniuc
4a846731ee
Used different syntax for accessing site parameters. 2018-08-29 12:23:59 +03:00
Cosmin Humeniuc
4721b523ca
Added 'header_visible' parameter to allow switching off the header. 2018-08-29 12:23:54 +03:00
cbd7140e63
layouts/_default/baseof.html: Update navbar menu template
Uses the same code as the Hugo menu template example, which should be
more robust with nested menus.
2018-03-09 20:29:11 +02:00
1655b876a8
Use .Site.Params.mainSections instead of hard coding "post" type
Hugo 0.32 or so added the quasi-magical .Site.Params.mainSections slice
that returns a range over the section that has the most number of pages.

This way we don't need to hard code the "post" type, and instead simply
use the pages that the user has created. Hugo's quickstart, for example,
recommends users create "posts", which currently doesn't work with this
theme!

Closes #89
2018-03-09 17:50:03 +02:00
Noah Zoschke
9cce778e86 blocks for masthead, header, body and footer 2018-01-02 13:52:23 -08:00
a81ed6803b
layouts/_default/baseof.html: Allow disabling of SRI
Some sites using edge caching like that on a CDN or S3 might have
issues with assets being cached too long, causing user agents to
refuse to load assets due to SRI hash mismatch. These sites should
disable the use of sub-resource integrity hashes using this config
option in their config:

    disable_sri = true
2017-04-12 21:38:10 +03:00
e7749e9bde
layouts/_default/baseof.html: Don't create whitespace
Cleans up some template logic so that extra, unnecessary whitespace
isn't created during site generation.
2017-04-04 12:21:52 +03:00
77671af35d
layouts/: Use absLangURL to determine active page in menu
On sites with multiple languages we need to use the absolute URL in
the test to determine if the current page should be marked "active"
in the menu bar. Perhaps a bug with Hugo that relative links end up
like "/bg/bg/about" instead of "/bg/about".
2017-04-04 12:03:07 +03:00
09d089f214
layouts/_default/baseof.html: Remove trailing whitespace 2017-04-04 11:54:30 +03:00
zidenis
e811b25fdc highlights the current navbar menu entry 2017-04-04 11:53:38 +03:00
8ab05ae625
Add Schema.org implementation based on JSON-LD
This replaces the metadata that Hugo's own schema.html template had
been providing, but does so in JSON-LD notation rather than via the
use of <meta> tags (this is Google's currently recommended form of
specifying this markup). There are a few exceptions where I did not
follow the conventions used in Hugo's template, for example the use
of up to six images from a post's frontmatter, because Google's tool
only recognizes one image, as well as different logic for a post's
publish and modified dates (using enableGitInfo = true).

Using this new markup, Google's Structured Data Testing Tool is now
able to understand site metadata much better (before it was reading
none).

The implementation here is a mix of the elements and types from the
official Schema.org types—for example, Blog and BlogPosting—as well
as from Google's search documentation. Note that Google's docs are
geared towards AMP, where some metadata is required, while for non-
AMP pages the metadata is just recommended.

We will have to re-evaluate this in the future, for example to add
height and width information to image metadata.

See: https://schema.org/Blog
See: https://schema.org/BlogPosting
See: https://developers.google.com/search/docs/data-types/data-type-selector
See: https://search.google.com/structured-data/testing-tool
2017-01-20 15:58:30 +02:00
0e381ab120
Start using SRI hashes for CSS/JS assets
Uses Hugo's site data mechanism to load pre-generated asset hashes.
2017-01-11 10:42:49 +02:00
af39372a24
layouts/_default/baseof.html: Revert to simple "read more" link
Prepending the site's URL to relative links was a hack but at the
time I couldn't understand why href="#" didn't take us to the top
of the page. It turns out that this was because of the <base> tag
that I have now removed.
2017-01-05 15:23:09 +02:00
fa0df752a1
layouts/_default/baseof.html: Remove base tag
It was screwing up relative links like the ones in footnotes. I'm
not sure why I added it in the first place, actually, as the docs
specifically say "specifies the base URL to use for all relative
URLs contained within a document".

See: https://developer.mozilla.org/en/docs/Web/HTML/Element/base
2017-01-05 15:20:29 +02:00
ffb8487c13
layouts/_default/baseof.html: Remove second RSS link
link tags with rel="feed" don't seem to be valid. They are flagged
by the w3c validator and modern documentation only mentions the use
of rel="alternate", which we are already using.

See: https://validator.w3.org
See: https://developer.mozilla.org/en-US/docs/Web/RSS/Getting_Started/Syndicating
2017-01-05 14:34:10 +02:00
8616dd8c10
layouts/_default/baseof.html: Use .Site.RegularPages instead of .Site.Pages
Hugo 0.18 changes the pages returned by .Site.Pages, so we need to
use .Site.RegularPages in order to test the type.

See: https://github.com/spf13/hugo/releases/tag/v0.18
See: https://gohugo.io/templates/variables#site-variables
2016-12-25 17:56:24 +02:00
Mathieu GAUTHIER-LAFAYE
89f87e050b the "Back on top" link is now translatable. 2016-12-09 15:37:53 +01:00
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
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
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
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
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
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
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
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
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
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
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