<% if (is_post()) { %>

<%
let isNotAdditional = false;

post.copyright = Object.assign({
  author: author.name,
  url: (page.url || page.permalink)
}, post.copyright)

if (post.copyright.cc === undefined) {
  post.copyright.cc = theme.post.cc;
  isNotAdditional = true;
}
%>

<% if (post.copyright.cc) { %>

<%
let ccLicense = post.copyright.cc.toLowerCase();
let ccIcon = icon('fab fa-creative-commons', {type:'fa'});
let ccText = ccLicense.toUpperCase();
let ccType;
if (ccLicense === 'zero') {
  ccType = 'publicdomain/zero/1.0/';
} else {
  ccType = 'licenses/' + ccLicense + '/4.0/';
}
let ccURL = 'https://creativecommons.org/' + ccType;
%>

<div>
  <ul class="post-copyright">
    <li class="post-copyright-author">
      <strong><%= __('post.copyright.author') + __('symbol.colon') %> </strong>
      <%= post.copyright.author %>
    </li>
    <li class="post-copyright-link">
      <strong><%= __('post.copyright.link') + __('symbol.colon') %></strong>
      <a href="<%= post.copyright.url %>"><%= post.copyright.url %></a>
    <li class="post-copyright-license">
      <strong><%= __('post.copyright.license_title') + __('symbol.colon') %> </strong>
      <%- __(isNotAdditional?'post.copyright.license_content':'post.copyright.license_additional_content', `<a href="${ccURL}">${ccIcon + ccText}</a>`) -%>
    </li>
  </ul>
</div>
<% } %>
<% } %>
