-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use _data yaml file to manage friends link
- Loading branch information
Showing
7 changed files
with
169 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="friends-link-container"> | ||
<ul class="friends-link-list"> | ||
<% for (const f of theme.links) { %> | ||
<li class="friends-link-item"> | ||
<a href="<%= f.link %>"> | ||
<div class="content"> | ||
<div class="avatar radius"> | ||
<% if (f.avatar) { %> | ||
<img class="radius" alt="<%= f.name %>" src="<%= f.avatar %>"> | ||
<% } else { %> | ||
<i class="fas fa-user-friends"></i> | ||
<% } %> | ||
</div> | ||
<div class="info"> | ||
<div class="name"><%= f.name %></div> | ||
<div class="description"><%= f.description %></div> | ||
</div> | ||
</div> | ||
</a> | ||
</li> | ||
<% } %> | ||
</ul> | ||
<div class="clear"></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
hexo.on('generateBefore', function () { | ||
const rootConfig = hexo.config; | ||
if (hexo.locals.get) { | ||
const data = hexo.locals.get('data'); | ||
if (data && data._config) { | ||
hexo.theme.config = data._config; | ||
} | ||
|
||
if (hexo.locals.get) { | ||
const data = hexo.locals.get('data'); | ||
|
||
if (data) { | ||
|
||
// theme config file handle | ||
if (data._config) { | ||
hexo.theme.config = data._config; | ||
|
||
} else if (data.keep) { | ||
hexo.theme.config = data.keep; | ||
|
||
} else if (data._keep) { | ||
hexo.theme.config = data._keep; | ||
} | ||
|
||
// friends link file handle | ||
if (data.links || data.link) { | ||
hexo.theme.config.links = (data.links || data.link); | ||
} | ||
|
||
} | ||
hexo.theme.config.rootConfig = rootConfig; | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
$tools-item-width = 30px; | ||
$tools-item-width = 32px; | ||
|
||
.side-tools-container { | ||
position: relative; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters