Skip to content

Commit

Permalink
Remove post type quote & picture (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Aug 16, 2019
1 parent 6701fa4 commit 92fdf86
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 57 deletions.
8 changes: 2 additions & 6 deletions layout/_macro/post-collapse.swig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{%- endif %}
{# endshow #}

<article class="post post-type-{{ post.type | default('normal') }}" itemscope itemtype="http://schema.org/Article">
<article class="post" itemscope itemtype="http://schema.org/Article">
<header class="post-header">

<{%- if theme.seo %}h3{% else %}h2{%- endif %} class="post-title">
Expand All @@ -23,11 +23,7 @@
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }}
{% else %}
<a class="post-title-link" href="{{ url_for(post.path) }}" itemprop="url">
{%- if post.type === 'picture' %}
{{ post.content }}
{% else %}
<span itemprop="name">{{ post.title | default(__('post.untitled')) }}</span>
{%- endif %}
<span itemprop="name">{{ post.title | default(__('post.untitled')) }}</span>
</a>
{%- endif %}
</{%- if theme.seo %}h3{% else %}h2{%- endif %}>
Expand Down
63 changes: 25 additions & 38 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{%- set headlessPost = Array.prototype.indexOf.call(['quote', 'picture'], post.type) > -1 %}

{%- set post_class = 'post post-type-' + post.type | default('normal') %}
{%- if post_extra_class > 0 %}
{%- set post_class = post_class + ' ' + post_extra_class | default('') %}
{%- endif %}
{%- set post_class = 'post' %}
{%- if post.sticky > 0 %}
{%- set post_class = post_class + ' post-sticky' %}
{%- endif %}
Expand All @@ -29,35 +24,31 @@
<meta itemprop="name" content="{{ title }}">
</span>

{%- if not headlessPost %}
{%- if post.header !== false %}
<header class="post-header">

{# Not to show title for quote posts that do not have a title #}
{%- if not (is_index and post.type === 'quote' and not post.title) %}
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="post-title{%- if post.direction && post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="name headline">{#
#}{# Link posts #}{#
#}{%- if post.link %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
</span>
{%- endif %}
{%- set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{%- set postText = post.title or post.link %}
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }}
{% elif is_index %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
</span>
{%- endif %}
{{ next_url(post.path, post.title | default(__('post.untitled')), {class: 'post-title-link', itemprop: 'url' }) }}
{% else -%}
{{- post.title -}}
{% include '../_partials/post-edit.swig' %}
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="post-title{%- if post.direction &&post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="name headline">{#
#}{# Link posts #}{#
#}{%- if post.link %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
</span>
{%- endif %}
</{%- if theme.seo %}h2{% else %}h1{%- endif %}>
{%- endif %}
{%- set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{%- set postText = post.title or post.link %}
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }}
{% elif is_index %}
{%- if post.sticky > 0 %}
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
<i class="fa fa-thumb-tack"></i>
</span>
{%- endif %}
{{ next_url(post.path, post.title | default(__('post.untitled')), {class: 'post-title-link', itemprop: 'url' }) }}
{% else -%}
{{- post.title -}}
{% include '../_partials/post-edit.swig' %}
{%- endif %}
</{%- if theme.seo %}h2{% else %}h1{%- endif %}>

<div class="post-meta">

Expand Down Expand Up @@ -233,11 +224,7 @@
{%- endif %}
<!--/noindex-->
{% else %}
{%- if post.type === 'picture' %}
<a href="{{ url_for(post.path) }}">{{ post.content }}</a>
{% else %}
{{ post.content }}
{%- endif %}
{{ post.content }}
{%- endif %}
{% else %}
{{ post.content }}
Expand Down
12 changes: 0 additions & 12 deletions source/css/_common/components/post/post-type.styl

This file was deleted.

1 change: 0 additions & 1 deletion source/css/_common/components/post/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
@import 'post-rtl';
@import 'post-tags';
@import 'post-title';
@import 'post-type';

@import 'post-reward' if (hexo-config('reward_settings.enable'));

Expand Down

0 comments on commit 92fdf86

Please sign in to comment.