Skip to content

Commit

Permalink
feat(home): write about me in markdown, reST or asciidoc
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Previously LANDING_PAGE_ABOUT was a dictionary that contained html tags. We used it
to create landing page. But users have demanded from the very beginning to be able to write the
landing page in markdown. This patch adds this feature. But in order to use it, you have to update
your configuration.

fix #85
  • Loading branch information
talha131 committed Jun 30, 2019
1 parent 23e0b94 commit 9b5b2ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
13 changes: 4 additions & 9 deletions templates/_includes/_defaults.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,12 @@
{% set USE_SHORTCUT_ICONS = USE_SHORTCUT_ICONS %}
{% endif %}

{# It is a dictionary with two keys: title, details. Value of each key is a
string. It is used to display About me section on the home page.
LANDING_PAGE_ABOUT = {'title': 'Talha Mansoor',
'details': '<p>I am a software developer. This blog is'
'my personal space in the cyber world!</p>'
}
{# It is a string
#}
{% if not LANDING_PAGE_ABOUT %}
{% set LANDING_PAGE_ABOUT = '' %}
{% if not LANDING_PAGE_TITLE %}
{% set LANDING_PAGE_TITLE = '' %}
{% else %}
{% set LANDING_PAGE_ABOUT = LANDING_PAGE_ABOUT %}
{% set LANDING_PAGE_TITLE = LANDING_PAGE_TITLE %}
{% endif %}

{# It is an array of dictionaries. Each dictionary has three keys: name, url,
Expand Down
36 changes: 22 additions & 14 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

{% block meta_tags_in_head %}
{{ super() }}
{% from '_includes/_defaults.html' import LANDING_PAGE_ABOUT with context %}
{% if LANDING_PAGE_ABOUT and LANDING_PAGE_ABOUT.title %}
<meta property="og:title" content="{{ LANDING_PAGE_ABOUT.title|e }}"/>
<meta name="twitter:title" content="{{ LANDING_PAGE_ABOUT.title|e }}">
{% from '_includes/_defaults.html' import LANDING_PAGE_TITLE with context %}
{% if LANDING_PAGE_TITLE %}
<meta property="og:title" content="{{ LANDING_PAGE_TITLE|e }}"/>
<meta name="twitter:title" content="{{ LANDING_PAGE_TITLE|e }}">
{% else %}
<meta property="og:title" content="{{ SITENAME|striptags|e }}"/>
<meta name="twitter:title" content="{{ SITENAME|striptags|e }}">
Expand All @@ -30,39 +30,47 @@
{% endblock meta_tags_in_head %}

{% block content %}
{% from '_includes/_defaults.html' import LANDING_PAGE_ABOUT with context %}
{% from '_includes/_defaults.html' import LANDING_PAGE_TITLE with context %}
{% from '_includes/_defaults.html' import PROJECTS with context %}
{% from '_includes/_defaults.html' import PROJECTS_TITLE with context %}

{% set landing_page = namespace(page=false) %}
{% for p in hidden_pages if p.slug == "landing-page-about-hidden" %}
{% set landing_page.page = p %}
{% endfor %}

{{landing_page.page.title}}

<div class="row-fluid">
{% if LANDING_PAGE_ABOUT and LANDING_PAGE_ABOUT.title %}
{% if LANDING_PAGE_TITLE %}
{% set css_class = 'span10 offset2' %}
{% if PROJECTS and LANDING_PAGE_ABOUT %}
{% if PROJECTS and LANDING_PAGE_TITLE %}
{% set css_class = 'span12' %}
{% endif %}
<header class="page-header {{css_class}}">
<h1><a href="{{ SITEURL }}">{{ LANDING_PAGE_ABOUT.title }}</a></h1>
<h1><a href="{{ SITEURL }}">{{ LANDING_PAGE_TITLE }}</a></h1>
</header>
{% endif %}

<div class="row-fluid">
{% if LANDING_PAGE_ABOUT and LANDING_PAGE_ABOUT.details %}
{% if LANDING_PAGE_TITLE and landing_page.page %}
{% set css_class = 'span8 offset2' %}
{% if PROJECTS and LANDING_PAGE_ABOUT %}
{% if PROJECTS and LANDING_PAGE_TITLE %}
{% set css_class = 'span8' %}
{% endif %}
<div class="{{css_class}}">
<header>
<h1 id="about-me">About me</h1>
<h1 id="about-me">{{landing_page.page.title}}</h1>
</header>
<div class="article-content">
{{ LANDING_PAGE_ABOUT.details }}
{{ landing_page.page.content }}
</div>
</div>
{% endif %}

{% if PROJECTS %}
{% set css_class = 'span8 offset2' %}
{% if PROJECTS and LANDING_PAGE_ABOUT %}
{% if PROJECTS and LANDING_PAGE_TITLE %}
{% set css_class = 'span4' %}
{% endif %}
<div class="{{css_class}}">
Expand All @@ -82,7 +90,7 @@ <h1 id="my-projects">{{ PROJECTS_TITLE }}</h1>

{% if articles %}
{% set css_class = 'span8 offset2' %}
{% if articles and PROJECTS and LANDING_PAGE_ABOUT %}
{% if articles and PROJECTS and LANDING_PAGE_TITLE %}
{% set css_class = 'span12' %}
{% endif %}
<div class="row-fluid">
Expand Down

0 comments on commit 9b5b2ec

Please sign in to comment.