mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-16 05:46:52 +00:00
Fix canonical urls and blog post dates
This commit is contained in:
parent
371245a261
commit
1ba86e8b08
76
plugins/filters.rb
Normal file
76
plugins/filters.rb
Normal file
@ -0,0 +1,76 @@
|
||||
module Jekyll
|
||||
module AssetFilter
|
||||
# Octopress filters
|
||||
# Copyright (c) 2014 Brandon Mathis
|
||||
|
||||
# MIT License
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
|
||||
def site_url
|
||||
'https://home-assistant.io'
|
||||
end
|
||||
|
||||
# Prepend a url with the full site url
|
||||
#
|
||||
# input - a url
|
||||
#
|
||||
# Returns input with all urls expanded to include the full site url
|
||||
# e.g. /images/awesome.gif => http://example.com/images/awesome.gif
|
||||
#
|
||||
def full_url(input)
|
||||
expand_url(input, site_url)
|
||||
end
|
||||
|
||||
# Prepends input with a url fragment
|
||||
#
|
||||
# input - An absolute url, e.g. /images/awesome.gif
|
||||
# url - The fragment to prepend the input, e.g. /blog
|
||||
#
|
||||
# Returns the modified url, e.g /blog
|
||||
#
|
||||
def expand_url(input, url=nil)
|
||||
url ||= root
|
||||
|
||||
url = if input.start_with?("http", url)
|
||||
input
|
||||
else
|
||||
File.join(url, input)
|
||||
end
|
||||
|
||||
smart_slash(url)
|
||||
end
|
||||
|
||||
# Ensure a trailing slash if a url ends with a directory
|
||||
def smart_slash(input)
|
||||
if !(input =~ /\.\w+$/)
|
||||
input = File.join(input, '/')
|
||||
end
|
||||
input
|
||||
end
|
||||
|
||||
# Convert url input into a standard canonical url by expanding urls and
|
||||
# removing url fragments ending with `index.[ext]`
|
||||
def canonical_url(input)
|
||||
full_url(input).sub(/index\.\w+$/i, '')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::AssetFilter)
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "Classifying the Internet of Things"
|
||||
description: ""
|
||||
date: 2016-02-11 22:31:00 -0800
|
||||
date: 2016-02-12 22:31:00 UTC
|
||||
date_formatted: "February 12, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "0.13: Speedtest.net, Bloomsky, Splunk and Garage Doors"
|
||||
description: "Home Assistant 0.13 brings test coverage to a whopping 90% and adds a whole bunch of new components."
|
||||
date: 2016-02-12 22:15:00 -0800
|
||||
date: 2016-02-13 22:15:00 UTC
|
||||
date_formatted: "February 13, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "Your hub should be local and open"
|
||||
description: "Running a hub that depends on the cloud is a risk that can cost you your home automation."
|
||||
date: 2016-04-04 21:11:00 -0700
|
||||
date: 2016-04-05 21:11:00 UTC
|
||||
date_formatted: "April 5, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "0.17: Onkyo, Panasonic, GTFS and config validation"
|
||||
description: "Home Assistant 0.17 has arrived."
|
||||
date: 2016-04-08 23:10:00 -0700
|
||||
date: 2016-04-09 23:10:00 UTC
|
||||
date_formatted: "April 9, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "Updated documentation"
|
||||
description: "We have reorganised our documentation which should make it easier to get started and develop for Home Assistant."
|
||||
date: 2016-04-16 23:09:00 -0700
|
||||
date: 2016-04-17 23:09:00 UTC
|
||||
date_formatted: "April 17, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "To Infinity and Beyond 🚀"
|
||||
description: "The state of Home Assistant: past, present, future."
|
||||
date: 2016-04-18 22:44:00 -0700
|
||||
date: 2016-04-19 22:44:00 UTC
|
||||
date_formatted: "April 19, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,8 +2,8 @@
|
||||
layout: post
|
||||
title: "0.18: Bluetooth, LG WebOS TVs and Roombas."
|
||||
description: "Home Assistant 0.18 has arrived."
|
||||
date: 2016-04-19 23:10:00 -0700
|
||||
date_formatted: "April 21, 2016"
|
||||
date: 2016-04-20 23:10:00 UTC
|
||||
date_formatted: "April 20, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
comments: true
|
||||
|
@ -2,8 +2,8 @@
|
||||
layout: post
|
||||
title: "0.27 is here to break eggs and take names: notifications, Hue fakery, safety and unification come to Home Assistant"
|
||||
description: "HTML5 push notifications and grouping support, Configuration validations and checking, cover, climate and fan."
|
||||
date: 2016-08-27 20:30:25 -0700
|
||||
date_formatted: "August 27, 2016"
|
||||
date: 2016-08-28 20:30:25 UTC
|
||||
date_formatted: "August 28, 2016"
|
||||
author: Robbie Trencheny
|
||||
author_twitter: Robbie
|
||||
comments: true
|
||||
|
@ -2,8 +2,8 @@
|
||||
layout: post
|
||||
title: "Explaining the Updater"
|
||||
description: "An update to the recent updater component changes"
|
||||
date: 2016-10-24 21:30:00 -0700
|
||||
date_formatted: "October 24, 2016"
|
||||
date: 2016-10-25 21:30:00 UTC
|
||||
date_formatted: "October 25, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
comments: true
|
||||
|
@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "Thank You"
|
||||
description: "Thanks to all our contributors, dependencies and companies that help make Home Assistant awesome."
|
||||
date: 2016-12-18 21:04:05 -0800
|
||||
date: 2016-12-19 21:04:05 UTC
|
||||
date_formatted: "December 19, 2016"
|
||||
author: Paulus Schoutsen
|
||||
author_twitter: balloob
|
||||
|
@ -2,8 +2,8 @@
|
||||
layout: post
|
||||
title: "Smart Baby Monitor"
|
||||
description: "How to build your own smart baby monitor"
|
||||
date: 2017-02-04 00:00:00 +0100
|
||||
date_formatted: "February 4, 2017"
|
||||
date: 2017-02-03 01:00:00 UTC
|
||||
date_formatted: "February 3, 2017"
|
||||
author: Pascal Vizeli
|
||||
comments: true
|
||||
categories: How-To
|
||||
|
Loading…
x
Reference in New Issue
Block a user