Skip to content

Commit

Permalink
Using explicitly set title if any
Browse files Browse the repository at this point in the history
  • Loading branch information
kizu committed Jul 14, 2013
1 parent 5366ab9 commit 6b4d23d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions get_title.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ Check if the first line contains `# `, then set the `processed_title` to the fou
{% capture processed_title %}{{ page.title }}{% endcapture %}
{% endif %}
```

And, finally, check for the current title, so we would use the explicitly set title instead of H1 one.

``` django
{% assign name_from_url = processed_post.url | split:'/' | last %}
{% assign name_from_title = processed_post.title | downcase | replace:' ','-' %}
{% if processed_post.title %}
{% if name_from_url != name_from_title %}
{% assign processed_title = processed_post.title %}
{% endif %}
{% endif %}
```

0 comments on commit 6b4d23d

Please sign in to comment.