Skip to content

Fix bug when search in a post #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions layout/_partial/post.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,29 @@
<div class="tableContent fade-in"
data-message="<%= post.toc %>"></div>
<% } %>
<%- partial('post/copyright')%>
</div>
<div id="post-footer" class="post-footer main-content-wrap <%= post.toc? 'content-with-table' : ''%>">
<% if ((post.tags) && (post.tags.length > 0)) { %>
<div class="post-footer-tags">
<span class="text-color-light text-small"><%= __('post.tagged_in') %></span><br/>
<%- partial('post/tag', {tags: post.tags})%>
</div>
<% } %>
<% if (post.actions === undefined || post.actions) { %>
<%- partial('post/actions', {postContent: postContent}) %>
<% } %>
<% if (post.comments) { %>
<% if (theme.disqus_shortname) { %>
<%- partial('post/disqus') %>
<% } else if (theme.gitment.enable) { %>
<%- partial('post/gitment') %>
<% } %>
<% if (is_post()) { %>
<%- partial('post/copyright')%>
<% } %>
</div>
<% if (is_post()) { %>
<div id="post-footer" class="post-footer main-content-wrap <%= post.toc? 'content-with-table' : ''%>">
<% if ((post.tags) && (post.tags.length > 0)) { %>
<div class="post-footer-tags">
<span class="text-color-light text-small"><%= __('post.tagged_in') %></span><br/>
<%- partial('post/tag', {tags: post.tags})%>
</div>
<% } %>
<% if (post.actions === undefined || post.actions) { %>
<%- partial('post/actions', {postContent: postContent}) %>
<% } %>
<% if (post.comments) { %>
<% if (theme.disqus_shortname) { %>
<%- partial('post/disqus') %>
<% } else if (theme.gitment.enable) { %>
<%- partial('post/gitment') %>
<% } %>
<% } %>
</div>
<% } %>
</article>

4 changes: 2 additions & 2 deletions layout/_partial/search.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<div class="media">
<% if (post.thumbnailImageUrl) { %>
<div class="media-left">
<a class="link-unstyled" href="<%= post.link || post.permalink %>">
<a class="link-unstyled" href="<%= post.permalink || post.permalink %>">
Copy link
Owner

@cherlas cherlas Apr 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tks for PR, but there no error for this file, post.link is external link of the post, and post.permalink is full url for it. There an error in search.js file.
tks again.

<img class="media-image" src="<%= post.thumbnailImageUrl %>" width="90" height="90"/>
</a>
</div>
<% } %>
<div class="media-body">
<a class="link-unstyled" href="<%= post.link || post.permalink %>">
<a class="link-unstyled" href="<%= post.permalink || post.permalink %>">
<h3 class="media-heading"><%= post.title %></h3>
</a>
<span class="media-meta">
Expand Down
2 changes: 1 addition & 1 deletion source/_js/search-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
var html = '';
posts.forEach(function(post) {
html += '<div class="media">';
html += '<a class="search-title" href="' + post.path + '">';
html += '<a class="search-title" href="' + post.permalink + '">';
html += '<i class="fa fa-quote-left"></i>';
html += '<span id="search-post-title">' + post.title + '</span>';
html += '</a>';
Expand Down