Skip to content

Commit 6079cda

Browse files
authored
Add version query string to Aliki assets for cache busting (#1476)
1 parent c55c1f5 commit 6079cda

File tree

2 files changed

+94
-27
lines changed

2 files changed

+94
-27
lines changed

lib/rdoc/generator/template/aliki/_head.rhtml

Lines changed: 93 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,88 +4,155 @@
44
<title><%= h @title %></title>
55

66
<%- if defined?(klass) %>
7-
<meta name="keywords" content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>">
8-
7+
<meta
8+
name="keywords"
9+
content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>"
10+
>
911
<%- if klass.comment.empty? %>
10-
<meta name="description" content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>">
12+
<meta
13+
name="description"
14+
content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>"
15+
>
1116
<%- else %>
12-
<meta name="description" content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>">
17+
<meta
18+
name="description"
19+
content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>"
20+
>
1321
<%- end %>
1422
<%- elsif defined?(file) %>
1523
<meta name="keywords" content="ruby,documentation,<%= h file.page_name %>">
16-
<meta name="description" content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>">
24+
<meta
25+
name="description"
26+
content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>"
27+
>
1728
<%- elsif @title %>
1829
<meta name="keywords" content="ruby,documentation,<%= h @title %>">
19-
2030
<%- if @options.main_page and
2131
main_page = @files.find { |f| f.full_name == @options.main_page } then %>
22-
<meta name="description" content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>">
32+
<meta
33+
name="description"
34+
content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>"
35+
>
2336
<%- else %>
2437
<meta name="description" content="Documentation for <%= h @title %>">
2538
<%- end %>
2639
<%- end %>
2740

2841
<%- if canonical_url = @options.canonical_root %>
29-
<% canonical_url = current.canonical_url if defined?(current) %>
30-
<link rel="canonical" href="<%= canonical_url %>">
42+
<% canonical_url = current.canonical_url if defined?(current) %>
43+
<link rel="canonical" href="<%= canonical_url %>">
3144
<%- end %>
3245

3346
<!-- Open Graph / Facebook -->
3447
<meta property="og:type" content="website">
3548
<meta property="og:title" content="<%= h @title %>">
49+
3650
<%- if defined?(klass) %>
3751
<%- if klass.comment.empty? %>
38-
<meta property="og:description" content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples">
52+
<meta
53+
property="og:description"
54+
content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples"
55+
>
3956
<%- else %>
4057
<meta property="og:description" content="<%= h excerpt(klass.comment) %>">
4158
<%- end %>
4259
<%- elsif defined?(file) %>
4360
<%- if file.comment.empty? %>
44-
<meta property="og:description" content="<%= h file.page_name %> - <%= h @title %> documentation">
61+
<meta
62+
property="og:description"
63+
content="<%= h file.page_name %> - <%= h @title %> documentation"
64+
>
4565
<%- else %>
4666
<meta property="og:description" content="<%= h excerpt(file.comment) %>">
4767
<%- end %>
4868
<%- else %>
49-
<meta property="og:description" content="API documentation for <%= h @title %> - Browse classes, modules, and methods">
69+
<meta
70+
property="og:description"
71+
content="API documentation for <%= h @title %> - Browse classes, modules, and methods"
72+
>
5073
<%- end %>
74+
5175
<%- if canonical_url = @options.canonical_root %>
52-
<% canonical_url = current.canonical_url if defined?(current) %>
53-
<meta property="og:url" content="<%= canonical_url %>">
76+
<% canonical_url = current.canonical_url if defined?(current) %>
77+
<meta property="og:url" content="<%= canonical_url %>">
5478
<%- end %>
5579

5680
<!-- Twitter -->
5781
<meta name="twitter:card" content="summary">
5882
<meta name="twitter:title" content="<%= h @title %>">
83+
5984
<%- if defined?(klass) %>
6085
<%- if klass.comment.empty? %>
61-
<meta name="twitter:description" content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples">
86+
<meta
87+
name="twitter:description"
88+
content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples"
89+
>
6290
<%- else %>
6391
<meta name="twitter:description" content="<%= h excerpt(klass.comment) %>">
6492
<%- end %>
6593
<%- elsif defined?(file) %>
6694
<%- if file.comment.empty? %>
67-
<meta name="twitter:description" content="<%= h file.page_name %> - <%= h @title %> documentation">
95+
<meta
96+
name="twitter:description"
97+
content="<%= h file.page_name %> - <%= h @title %> documentation"
98+
>
6899
<%- else %>
69100
<meta name="twitter:description" content="<%= h excerpt(file.comment) %>">
70101
<%- end %>
71102
<%- else %>
72-
<meta name="twitter:description" content="API documentation for <%= h @title %> - Browse classes, modules, and methods">
103+
<meta
104+
name="twitter:description"
105+
content="API documentation for <%= h @title %> - Browse classes, modules, and methods"
106+
>
73107
<%- end %>
74108

75109
<script type="text/javascript">
76110
var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
77111
var index_rel_prefix = "<%= h rel_prefix %>/";
78112
</script>
79113

80-
<script src="<%= h asset_rel_prefix %>/js/theme-toggle.js"></script>
81-
<script src="<%= h asset_rel_prefix %>/js/navigation.js" defer></script>
82-
<script src="<%= h asset_rel_prefix %>/js/search.js" defer></script>
83-
<script src="<%= h asset_rel_prefix %>/js/search_index.js" defer></script>
84-
<script src="<%= h asset_rel_prefix %>/js/searcher.js" defer></script>
85-
<script src="<%= h asset_rel_prefix %>/js/c_highlighter.js" defer></script>
86-
<script src="<%= h asset_rel_prefix %>/js/aliki.js" defer></script>
114+
<script
115+
src="<%= h asset_rel_prefix %>/js/theme-toggle.js?v=<%= h RDoc::VERSION %>"
116+
></script>
117+
118+
<script
119+
src="<%= h asset_rel_prefix %>/js/navigation.js?v=<%= h RDoc::VERSION %>"
120+
defer
121+
></script>
122+
123+
<script
124+
src="<%= h asset_rel_prefix %>/js/search.js?v=<%= h RDoc::VERSION %>"
125+
defer
126+
></script>
127+
128+
<script
129+
src="<%= h asset_rel_prefix %>/js/search_index.js?v=<%= h RDoc::VERSION %>"
130+
defer
131+
></script>
132+
133+
<script
134+
src="<%= h asset_rel_prefix %>/js/searcher.js?v=<%= h RDoc::VERSION %>"
135+
defer
136+
></script>
137+
138+
<script
139+
src="<%= h asset_rel_prefix %>/js/c_highlighter.js?v=<%= h RDoc::VERSION %>"
140+
defer
141+
></script>
142+
143+
<script
144+
src="<%= h asset_rel_prefix %>/js/aliki.js?v=<%= h RDoc::VERSION %>"
145+
defer
146+
></script>
147+
148+
<link
149+
href="<%= h asset_rel_prefix %>/css/rdoc.css?v=<%= h RDoc::VERSION %>"
150+
rel="stylesheet"
151+
>
87152

88-
<link href="<%= h asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
89153
<%- @options.template_stylesheets.each do |stylesheet| %>
90-
<link href="<%= h asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
154+
<link
155+
href="<%= h asset_rel_prefix %>/<%= h File.basename stylesheet %>?v=<%= h RDoc::VERSION %>"
156+
rel="stylesheet"
157+
>
91158
<%- end %>

lib/rdoc/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ module RDoc
55
##
66
# RDoc version you are using
77

8-
VERSION = '6.16.0'
8+
VERSION = '6.16.1'
99

1010
end

0 commit comments

Comments
 (0)