pattex / jekyll-tagging

Jekyll plugin to automatically generate a tag cloud and tag pages.
385 stars 76 forks source link

Title of tag page #52

Closed farzindev closed 8 years ago

farzindev commented 8 years ago

Hi, I need the tag title in my default layout like this: <title>Tag title - Blog title</title> for post we have:

{% if page.title %}
  {{ page.title | escape }} - {{ site.title | escape }}
{% else %}
  {{ site.title | escape }}
{% endif %}

but how can I add if it was page.tag ?

farzindev commented 8 years ago

Well, Actually I fixed it without using the default layout. is not bad. but any other solution ?

---
layout: null
---
<!DOCTYPE html>
<html lang="en">

<head>
{% include head.html %}
<title> {{ page.tag | escape }} - {{ site.title | escape }} </title>
</head>

<body>
    {% include header.html %}
    <section class="content">
        <h2 class="notes-title">{{ page.tag }}</h2>
        <ul class="note-list">
            {% for post in page.posts %}
            <li><h2><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h2><time datetime="{{post.date | date: '%Y-%m-%d'}}" itemprop="datePublished">{{post.date | date: '%Y-%m-%d'}}</time></li>
            {% endfor %}
        </ul>
    </section>
    {% include footer.html %}
</body>
</html>
Vallek commented 1 year ago

I know it's old, but if someone like me still needs it) You can edit one line in jekyll-tagging gem.

Find Ruby: where ruby

Gems are at: Ruby\lib\ruby\gems\version\gems\

Open jekyll-tagging-1.1.0\lib\jekyll\tagging.rb

Find

data = { 'layout' => layout, 'posts' => posts.sort.reverse!, 'tag' => tag }

and change it to something like:

data = { 'layout' => layout, 'posts' => posts.sort.reverse!, 'tag' => tag, 'title' => 'Posts about' + ' ' + tag }