Skip to content

Commit 28eceaa

Browse files
author
ppoffice
committed
feat: replace fancybox with lightgallery
1 parent ac561d9 commit 28eceaa

59 files changed

Lines changed: 5589 additions & 3247 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ Icarus knows on what screen size you are browsering the website, and reorganize
3838

3939
Get your categories and tags listed in single pages to make your blog more methodic.
4040

41-
### Fancybox
41+
### lightgallery
4242

43-
Icarus uses [Fancybox] to showcase your photos. You can use Markdown syntax or fancybox tag plugin to add your photos.
43+
Icarus uses [lightgallery.js](https://sachinchoolur.github.io/lightgallery.js/) to showcase your photos. Just enable it in your configuration, and that's all!
4444

45-
```
46-
![img caption](img url)
47-
```
45+
![](http://ppoffice.github.io/hexo-theme-icarus/gallery/lightgallery.jpg "")
4846

4947
### Sidebar
5048

_config.yml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ share: default # options: jiathis, bdshare, addtoany, default
5959

6060
# Plugins
6161
plugins:
62-
fancybox: true # options: true, false
62+
lightgallery: true # options: true, false
6363
google_analytics: # enter the tracking ID for your Google Analytics
6464
google_site_verification: # enter Google site verification code
6565
baidu_analytics: # enter Baidu Analytics hash key

_source/about/index.md

Lines changed: 0 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -1,206 +1,4 @@
11
title: "About"
22
layout: "page"
33
---
4-
### The blog theme you may fall in love with, coming to Hexo. [Preview](http://ppoffice.github.io/hexo-theme-icarus/)
5-
![](http://ppoffice.github.io/hexo-theme-icarus/gallery/preview.jpg "")
6-
7-
## Installation
8-
9-
### Install
10-
11-
``` bash
12-
$ git clone https://github.com/ppoffice/hexo-theme-icarus.git themes/icarus
13-
```
14-
15-
**Icarus requires Hexo 3.0 and above.**
16-
17-
### Enable
18-
19-
1. Rename `themes\icarus\_config.yml.example` to `themes\icarus\_config.yml`;
20-
2. Copy `themes\icarus\_config.yml.site.example` to your hexo blog's root directory and rename it to `_config.yml`;
21-
3. Copy `themes\icarus\_source\*` into your hexo blog's directory `source`;
22-
4. Then modify `theme` setting in `_config.yml` to `icarus`.
23-
24-
### Update
25-
26-
``` bash
27-
cd themes/icarus
28-
git pull
29-
```
30-
31-
## Configuration
32-
33-
### Theme configuration example
34-
```r
35-
# Header
36-
menu:
37-
Home: .
38-
Archives: archives
39-
Categories: categories # you need to add extra page to enable this, please see the config below.
40-
Tags: tags # you need to add extra page to enable this, please see the config below.
41-
About: about
42-
43-
# Content
44-
excerpt_link: Read More
45-
fancybox: true
46-
47-
# Sidebar
48-
sidebar: right
49-
widgets:
50-
- recent_posts
51-
- category
52-
- tag
53-
- tagcloud
54-
- archive
55-
thumbnail: true
56-
57-
# Contacts
58-
contacts:
59-
github: http://github.com/ppoffice/hexo-theme-icarus
60-
twitter: '#'
61-
facebook: '#'
62-
dribbble: '#'
63-
rss: atom.xml
64-
65-
# Links
66-
links:
67-
Hexo: http://hexo.io
68-
69-
# Miscellaneous
70-
google_analytics:
71-
favicon: favicon.png
72-
twitter:
73-
google_plus:
74-
fb_admins:
75-
fb_app_id:
76-
```
77-
78-
- **excerpt_link** - Cooperate with `<!-- more -->` tag to show only part of the article in index pages.
79-
- **fancybox** - Enable [Fancybox].
80-
- **contacts** - Your social network links, RSS link, etc.
81-
- **widgets** - Widgets displaying in sidebar.
82-
- **thumbnail** - Whether to show post thumbnails in the sidebar and archive pages.
83-
- **links** - Links displayed in the link widget.
84-
- **google_analytics** - Google Analytics ID.
85-
- **favicon** - Favicon path.
86-
87-
### Site configuration example
88-
```r
89-
# Site
90-
title: Icarus
91-
subtitle:
92-
description: Hexo theme - Icarus
93-
author: PPOffice
94-
author_title: 'Web Developer & Designer'
95-
avatar: css/images/avatar.png
96-
location: 'Harbin, China'
97-
language: en
98-
timezone:
99-
100-
...
101-
102-
# Disqus
103-
disqus_shortname:
104-
```
105-
106-
- **author** - Your name.
107-
- **author_title** - Title to your occupation.
108-
- **avatar** - Your avatar image link.
109-
- **location** - Where you live in.
110-
- **disqus_shortname** - Your Disqus shortname.
111-
112-
### Post Thumbnail & Banner
113-
114-
You can add a thumbnail and a banner to each post by adding the following lines into your post source files' front-matter:
115-
```r
116-
title: Demo
117-
date: 2015-01-01
118-
...
119-
# add those
120-
thumbnail: http://example.com/thumbnail.jpg
121-
banner: http://example.com/banner.jpg
122-
```
123-
124-
### Custom Categories & Tags Pages
125-
126-
To enable custom categories page and tags page, just copy the `categories` folder and `tags` folder under your theme's `_source` foler into your site's `source` folder. Then edit theme's _config.yml and add the following lines:
127-
```r
128-
# Header
129-
menu:
130-
...
131-
Categories: categories # -> add this line
132-
Tags: tags # -> and add this line
133-
...
134-
```
135-
136-
### Languages
137-
138-
English and Simplified Chinese are the default languages of the theme. You can add translations in the `languages` folder and change the default language in blog's `_config.yml`.
139-
140-
```r
141-
language: zh-CN
142-
```
143-
144-
## Features
145-
146-
### Profile Sidebar
147-
148-
A nice place to show yourself. You can add your own information in your site's `_config.yml`
149-
150-
![](http://ppoffice.github.io/hexo-theme-icarus/gallery/profile.png "")
151-
152-
### Post Banner & Thumbnail
153-
154-
Thanks to [atika](https://github.com/atika), you can now add thumbnails and banners to every post to create better reading experience.
155-
156-
### Responsive Layout
157-
158-
Icarus knows on what screen size you are browsering the website, and reorganize the layout to fit your device.
159-
160-
![](http://ppoffice.github.io/hexo-theme-icarus/gallery/responsive.jpg "")
161-
162-
### Custom Categories & Tags Pages
163-
164-
Get your categories and tags listed in single pages to make your blog more methodic.
165-
166-
### Fancybox
167-
168-
Icarus uses [Fancybox] to showcase your photos. You can use Markdown syntax or fancybox tag plugin to add your photos.
169-
170-
```
171-
![img caption](img url)
172-
```
173-
174-
### Sidebar
175-
176-
Icarus provides 6 built-in widgets:
177-
178-
- recent_posts
179-
- category
180-
- archives
181-
- tag
182-
- tagcloud
183-
- links
184-
185-
All of them are enabled by default. You can edit them in `widget` setting.
186-
187-
## Development
188-
189-
### Requirements
190-
191-
- [Grunt] 0.4+
192-
- Hexo 3.0+
193-
194-
### Grunt tasks
195-
196-
- **default** - Download [Fancybox] and [Font Awesome].
197-
- **fontawesome** - Only download [Font Awesome].
198-
- **fancybox** - Only download [Fancybox].
199-
- **clean** - Clean temporarily files and downloaded files.
200-
201-
[Hexo]: http://zespia.tw/hexo/
202-
[Fancybox]: http://fancyapps.com/fancybox/
203-
[Font Awesome]: http://fontawesome.io/
204-
[Grunt]: http://gruntjs.com/
205-
2064

layout/common/article.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<% if (post.banner) { %>
44
<%- partial('post/banner') %>
55
<% } %>
6-
<%- partial('post/gallery') %>
76
<% if (post.link || post.title) { %>
87
<header class="article-header">
98
<%- partial('post/title', { class_name: 'article-title' }) %>
@@ -16,6 +15,7 @@
1615
<% } %>
1716
</header>
1817
<% } %>
18+
<%- partial('post/gallery') %>
1919
<div class="article-entry" itemprop="articleBody">
2020
<% if (index && post.excerpt) { %>
2121
<p><%- post.excerpt %></p>

layout/common/post/gallery.ejs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<% if (post.photos && post.photos.length) { %>
22
<div class="article-gallery">
3-
<div class="article-gallery-photos">
4-
<% post.photos.forEach(function(photo, i) { %>
5-
<a class="article-gallery-img fancybox" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>">
6-
<img src="<%- url_for(photo) %>" itemprop="image">
7-
</a>
8-
<% }) %>
9-
</div>
3+
<% post.photos.forEach(function(photo, i) { %>
4+
<a class="gallery-item" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>">
5+
<img src="<%- url_for(photo) %>" itemprop="image" />
6+
</a>
7+
<% }) %>
108
</div>
119
<% } %>

layout/plugin/scripts.ejs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% if (typeof(isHead) !== 'undefined' && isHead) { %>
2-
<% if (theme.plugins.fancybox) { %>
3-
<%- css('vendor/fancybox/jquery.fancybox') %>
2+
<% if (theme.plugins.lightgallery) { %>
3+
<%- css('vendor/lightgallery/css/lightgallery.min') %>
44
<% } %>
55
<% if (theme.plugins.google_analytics) { %>
66
<%- partial('plugin/google-analytics') %>
@@ -12,7 +12,15 @@
1212
<%- partial('plugin/baidu-analytics') %>
1313
<% } %>
1414
<% } else { %>
15-
<% if (theme.plugins.fancybox) { %>
16-
<%- js('vendor/fancybox/jquery.fancybox.pack') %>
15+
<% if (theme.plugins.lightgallery) { %>
16+
<%- js('vendor/lightgallery/js/lightgallery.min') %>
17+
<%- js('vendor/lightgallery/js/lg-thumbnail.min') %>
18+
<%- js('vendor/lightgallery/js/lg-pager.min') %>
19+
<%- js('vendor/lightgallery/js/lg-autoplay.min') %>
20+
<%- js('vendor/lightgallery/js/lg-fullscreen.min') %>
21+
<%- js('vendor/lightgallery/js/lg-zoom.min') %>
22+
<%- js('vendor/lightgallery/js/lg-hash.min') %>
23+
<%- js('vendor/lightgallery/js/lg-share.min') %>
24+
<%- js('vendor/lightgallery/js/lg-video.min') %>
1725
<% } %>
1826
<% } %>

scripts/fancybox.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)