Skip to content

Instantly share code, notes, and snippets.

@online
Last active December 12, 2015 22:08
Show Gist options
  • Save online/1ee398a8785b3b883662 to your computer and use it in GitHub Desktop.
Save online/1ee398a8785b3b883662 to your computer and use it in GitHub Desktop.
Локализация даты в теме Ghost
<!DOCTYPE html>
<html>
<head>
{{! Document Settings }}
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> {{! Page Meta }}
<title>{{meta_title}}</title>
<meta name="description" content="{{meta_description}}" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="{{asset " favicon.ico "}}"> {{! Styles'n'Scripts }}
<link rel="stylesheet" type="text/css" href="{{asset " css/screen.css "}}" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" /> {{! Ghost outputs important style and meta data with this tag }} {{ghost_head}}
</head>
<body class="{{body_class}} nav-closed">
{{navigation}}
<div class="site-wrapper">
{{! Everything else gets inserted here }} {{{body}}}
<footer class="site-footer clearfix">
<section class="copyright"><a href="{{@blog.url}}">{{@blog.title}}</a> &copy; {{date format="YYYY"}}</section>
<section class="poweredby">Proudly published with <a href="https://ghost.org">Ghost</a></section>
</footer>
</div>
{{!-- jQuery needs to come before `{{ghost_foot}}` so that jQuery can be used in code injection --}}
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/locale/ru.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.4.1/moment-timezone-with-data-2010-2020.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
moment.locale('ru');
$('.post-date').each(function(i, date) {
var $date = $(date);
$date.html(
moment($date.attr('datetime'))
.tz('Europe/Kiev')
.format('LL')
);
});
});
</script>
{{! Ghost outputs important scripts and data with this tag }}
{{ghost_foot}}
<script type="text/javascript" src="{{asset " js/jquery.fitvids.js "}}"></script>
{{! The main JavaScript file for Casper }}
<script type="text/javascript" src="{{asset " js/index.js "}}"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment