Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 93 additions & 26 deletions lib/rdoc/generator/template/aliki/_head.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,88 +4,155 @@
<title><%= h @title %></title>

<%- if defined?(klass) %>
<meta name="keywords" content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>">

<meta
name="keywords"
content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>"
>
<%- if klass.comment.empty? %>
<meta name="description" content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>">
<meta
name="description"
content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>"
>
<%- else %>
<meta name="description" content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>">
<meta
name="description"
content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>"
>
<%- end %>
<%- elsif defined?(file) %>
<meta name="keywords" content="ruby,documentation,<%= h file.page_name %>">
<meta name="description" content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>">
<meta
name="description"
content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>"
>
<%- elsif @title %>
<meta name="keywords" content="ruby,documentation,<%= h @title %>">

<%- if @options.main_page and
main_page = @files.find { |f| f.full_name == @options.main_page } then %>
<meta name="description" content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>">
<meta
name="description"
content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>"
>
<%- else %>
<meta name="description" content="Documentation for <%= h @title %>">
<%- end %>
<%- end %>

<%- if canonical_url = @options.canonical_root %>
<% canonical_url = current.canonical_url if defined?(current) %>
<link rel="canonical" href="<%= canonical_url %>">
<% canonical_url = current.canonical_url if defined?(current) %>
<link rel="canonical" href="<%= canonical_url %>">
<%- end %>

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="<%= h @title %>">

<%- if defined?(klass) %>
<%- if klass.comment.empty? %>
<meta property="og:description" content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples">
<meta
property="og:description"
content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples"
>
<%- else %>
<meta property="og:description" content="<%= h excerpt(klass.comment) %>">
<%- end %>
<%- elsif defined?(file) %>
<%- if file.comment.empty? %>
<meta property="og:description" content="<%= h file.page_name %> - <%= h @title %> documentation">
<meta
property="og:description"
content="<%= h file.page_name %> - <%= h @title %> documentation"
>
<%- else %>
<meta property="og:description" content="<%= h excerpt(file.comment) %>">
<%- end %>
<%- else %>
<meta property="og:description" content="API documentation for <%= h @title %> - Browse classes, modules, and methods">
<meta
property="og:description"
content="API documentation for <%= h @title %> - Browse classes, modules, and methods"
>
<%- end %>

<%- if canonical_url = @options.canonical_root %>
<% canonical_url = current.canonical_url if defined?(current) %>
<meta property="og:url" content="<%= canonical_url %>">
<% canonical_url = current.canonical_url if defined?(current) %>
<meta property="og:url" content="<%= canonical_url %>">
<%- end %>

<!-- Twitter -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="<%= h @title %>">

<%- if defined?(klass) %>
<%- if klass.comment.empty? %>
<meta name="twitter:description" content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples">
<meta
name="twitter:description"
content="Documentation for <%= h klass.full_name %> <%= h klass.type %> - API reference and code examples"
>
<%- else %>
<meta name="twitter:description" content="<%= h excerpt(klass.comment) %>">
<%- end %>
<%- elsif defined?(file) %>
<%- if file.comment.empty? %>
<meta name="twitter:description" content="<%= h file.page_name %> - <%= h @title %> documentation">
<meta
name="twitter:description"
content="<%= h file.page_name %> - <%= h @title %> documentation"
>
<%- else %>
<meta name="twitter:description" content="<%= h excerpt(file.comment) %>">
<%- end %>
<%- else %>
<meta name="twitter:description" content="API documentation for <%= h @title %> - Browse classes, modules, and methods">
<meta
name="twitter:description"
content="API documentation for <%= h @title %> - Browse classes, modules, and methods"
>
<%- end %>

<script type="text/javascript">
var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
var index_rel_prefix = "<%= h rel_prefix %>/";
</script>

<script src="<%= h asset_rel_prefix %>/js/theme-toggle.js"></script>
<script src="<%= h asset_rel_prefix %>/js/navigation.js" defer></script>
<script src="<%= h asset_rel_prefix %>/js/search.js" defer></script>
<script src="<%= h asset_rel_prefix %>/js/search_index.js" defer></script>
<script src="<%= h asset_rel_prefix %>/js/searcher.js" defer></script>
<script src="<%= h asset_rel_prefix %>/js/c_highlighter.js" defer></script>
<script src="<%= h asset_rel_prefix %>/js/aliki.js" defer></script>
<script
src="<%= h asset_rel_prefix %>/js/theme-toggle.js?v=<%= h RDoc::VERSION %>"
></script>

<script
src="<%= h asset_rel_prefix %>/js/navigation.js?v=<%= h RDoc::VERSION %>"
defer
></script>

<script
src="<%= h asset_rel_prefix %>/js/search.js?v=<%= h RDoc::VERSION %>"
defer
></script>

<script
src="<%= h asset_rel_prefix %>/js/search_index.js?v=<%= h RDoc::VERSION %>"
defer
></script>

<script
src="<%= h asset_rel_prefix %>/js/searcher.js?v=<%= h RDoc::VERSION %>"
defer
></script>

<script
src="<%= h asset_rel_prefix %>/js/c_highlighter.js?v=<%= h RDoc::VERSION %>"
defer
></script>

<script
src="<%= h asset_rel_prefix %>/js/aliki.js?v=<%= h RDoc::VERSION %>"
defer
></script>

<link
href="<%= h asset_rel_prefix %>/css/rdoc.css?v=<%= h RDoc::VERSION %>"
rel="stylesheet"
>

<link href="<%= h asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
<%- @options.template_stylesheets.each do |stylesheet| %>
<link href="<%= h asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
<link
href="<%= h asset_rel_prefix %>/<%= h File.basename stylesheet %>?v=<%= h RDoc::VERSION %>"
rel="stylesheet"
>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These styling change is suggested by Herb. I personally feel fine with them but am open to apply custom rules later if anyone has any strong opinion.

<%- end %>
2 changes: 1 addition & 1 deletion lib/rdoc/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ module RDoc
##
# RDoc version you are using

VERSION = '6.16.0'
VERSION = '6.16.1'

end