class Bridgetown::Drops::UrlDrop
Public Instance Methods
categories()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 35 def categories category_set = Set.new Array(@obj.data["categories"]).each do |category| category_set << if @obj.site.config["slugify_categories"] Utils.slugify(category.to_s) else category.to_s.downcase end end category_set.to_a.join("/") end
collection()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 13 def collection @obj.collection.label end
day()
click to toggle source
DD: 01..31
# File lib/bridgetown-core/drops/url_drop.rb, line 58 def day @obj.date.strftime("%d") end
hour()
click to toggle source
hh: 00..23
# File lib/bridgetown-core/drops/url_drop.rb, line 63 def hour @obj.date.strftime("%H") end
i_day()
click to toggle source
D: 1..31
# File lib/bridgetown-core/drops/url_drop.rb, line 78 def i_day @obj.date.strftime("%-d") end
i_month()
click to toggle source
M: 1..12
# File lib/bridgetown-core/drops/url_drop.rb, line 83 def i_month @obj.date.strftime("%-m") end
locale()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 29 def locale locale_data = @obj.data["locale"] @obj.site.config["available_locales"].include?(locale_data) ? locale_data : nil end
Also aliased as: lang
long_day()
click to toggle source
ddd: Monday..Sunday
# File lib/bridgetown-core/drops/url_drop.rb, line 125 def long_day @obj.date.strftime("%A") end
long_month()
click to toggle source
MMMM: January..December
# File lib/bridgetown-core/drops/url_drop.rb, line 93 def long_month @obj.date.strftime("%B") end
minute()
click to toggle source
mm: 00..59
# File lib/bridgetown-core/drops/url_drop.rb, line 68 def minute @obj.date.strftime("%M") end
month()
click to toggle source
MM: 01..12
# File lib/bridgetown-core/drops/url_drop.rb, line 53 def month @obj.date.strftime("%m") end
name()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 17 def name Utils.slugify(@obj.basename_without_ext) end
second()
click to toggle source
ss: 00..59
# File lib/bridgetown-core/drops/url_drop.rb, line 73 def second @obj.date.strftime("%S") end
short_day()
click to toggle source
dd: Mon..Sun
# File lib/bridgetown-core/drops/url_drop.rb, line 120 def short_day @obj.date.strftime("%a") end
short_month()
click to toggle source
MMM: Jan..Dec
# File lib/bridgetown-core/drops/url_drop.rb, line 88 def short_month @obj.date.strftime("%b") end
short_year()
click to toggle source
YY: 00..99
# File lib/bridgetown-core/drops/url_drop.rb, line 98 def short_year @obj.date.strftime("%y") end
slug()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 25 def slug Utils.slugify(qualified_slug_data) end
title()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 21 def title Utils.slugify(qualified_slug_data, mode: "pretty", cased: true) end
w_day()
click to toggle source
d: 1..7 (Monday..Sunday)
# File lib/bridgetown-core/drops/url_drop.rb, line 115 def w_day @obj.date.strftime("%u") end
w_year()
click to toggle source
CCYYw, ISO week year may differ from CCYY for the first days of January and last days of December
# File lib/bridgetown-core/drops/url_drop.rb, line 104 def w_year @obj.date.strftime("%G") end
week()
click to toggle source
WW: 01..53 %W and %U do not comply with ISO 8601-1
# File lib/bridgetown-core/drops/url_drop.rb, line 110 def week @obj.date.strftime("%V") end
y_day()
click to toggle source
DDD: 001..366
# File lib/bridgetown-core/drops/url_drop.rb, line 130 def y_day @obj.date.strftime("%j") end
year()
click to toggle source
CCYY
# File lib/bridgetown-core/drops/url_drop.rb, line 48 def year @obj.date.strftime("%Y") end
Private Instance Methods
fallback_data()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 147 def fallback_data @fallback_data ||= {} end
qualified_slug_data()
click to toggle source
# File lib/bridgetown-core/drops/url_drop.rb, line 136 def qualified_slug_data slug_data = @obj.data["slug"] || @obj.basename_without_ext if @obj.data["locale"] slug_data.split(".").tap do |segments| segments.pop if segments.length > 1 && segments.last == @obj.data["locale"] end.join(".") else slug_data end end