Установка Octopress

Статья последний раз была обновлена 08.07.2024

Проверяем установку и версию ruby

ruby –version # ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

Скачиваем octopress

  git clone git://github.com/imathis/octopress.git octopress  cd octopress  

Установка зависимостей, необходимых компонентов для ruby

gem install bundler

и сразу

bundle install

Устанавливаем стандартную тему для octopress

rake install

Запуск генерации блога

time rake generate

Запуск встроенного в ruby веб-сервера

rake preview # http://localhost:4000/

Устанавливаем нестандартную тему

Темы можно посмотреть по адресу — https://github.com/imathis/octopress/wiki/3rd-Party-Octopress-Themes

  git clone https://github.com/gehaxelt/CSS-WhiteLake.git .themes/whitelake  git clone git://github.com/macjasp/cleanpress.git .themes/cleanpress  
  rake install['whitelake']  rake install['cleanpress']  rake generate  rake generate  

Создаем первый пост

rake new_post['Компьютерные технологии']
  • Будет создан файл source/_posts/2015-09-04-komp’iutiernyie-tiekhnologhii.markdown
  • Файл можно переименовать под корректный url
  • Можно отделить краткое описание поста от основного текста, если вставить < !– mоrе –>

Конфигурируем блог в файле _config.yml

  root: # Mapping for relative urls (default: /)  permalink: # Permalink structure for blog posts  source: # Directory for site source files  destination: # Directory for generated site files  plugins: # Directory for Jekyll plugins  code_dir: # Directory for code snippets (for include_code plugin)  category_dir: # Directory for generated blog category pages  pygments: # Toggle python pygments syntax highlighting  paginate: # Posts per page on the blog index  pagination_dir: # Directory base for pagination URLs eg. /blog/page/2/  recent_posts: # Number of recent posts to appear in the sidebar  default_asides: # Configure what shows up in the sidebar and in what order  blog_index_asides: # Optional sidebar config for blog index page  post_asides: # Optional sidebar config for post layout  page_asides: # Optional sidebar config for page layout  

также можно указать

  • Github — List your github repositories in the sidebar
  • Twitter — Add a button for sharing of posts and pages on Twitter
  • Google Plus One — Setup sharing for posts and pages on Google’s plus one network.
  • Pinboard — Share your recent Pinboard bookmarks in the sidebar.
  • Delicious — Share your recent Delicious bookmarks in the sidebar.
  • Disqus Comments — Add your disqus short name to enable disqus comments on your site.
  • Google Analytics — Add your tracking id to enable Google Analytics tracking for your site.

Добавляем еще страницы

  rake new_page[pagename] # создаем новую станицу  rake new_post[postname] # создаем новый файл  

Дополнительные шаги

  • Пишем посты на markdown, кидаем их в папку octopress/source/_posts и генерируем сайт
  • Использование плагинов на примере вставки видео с youtube в стиле отзывчивого веб-дизайна. За это отвечает плагин jekyll-youtube-lazyloading. Потребуется добавить файл youtube.rb в папку с плагинами plugin, скопировать файл _rve.sccs в /sass/custom и добавить строку @import «custom/rve» в файле /sass/screen.scss
  • Немного исправим конфигурацию, изменив файл _config.yml — root: /, permalink: /:title/. Стоит так же поправить файлы footer, header и т.д. под свои предпочтения. То есть идем в source и правим все под себя
  • Как выровнять текст в статьях с помощью justify? Все достаточно просто. Зайдите в файл sass/custom/_style.css и добавьте туда — article p{text-align:justify}

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *