-
Notifications
You must be signed in to change notification settings - Fork 560
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
Add tag support #48
Add tag support #48
Conversation
Tags can be added by simply following the Jekyll front-matter convention and adding I used the same theme styles as the Tags can be disabled by adding
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @divayprakash, this is awesome!
Just some tweaks to the design and markup:
- Move tags to below the content into the
footer
of thearticle
. - In terms of design, it'll be best to match the header meta design with the center alignment + text styled with the
.meta
class (see below)
Just something to think about, should I also display the post tags on the index.html page in the same location ie. under the post title? I haven't implemented that as of now.
I think it's best to keep the index free of the tags, as the index in this theme is intended as more of a summary.
Should I hide the tags page from appearing in the header's navigation bar?
Yes, hide the tags page link by default, we can explain in the docs how to add a nav link to the tags page, if users want to include a link to the page (or otherwise include it as an option)
The type-theme docs would need to be updated for this feature. I understand the change would need to be made to this file. How should we proceed with that?
Yep, please fork the repo at https://github.com/rohanchandra/rohanchandra.github.io/ to add your documentation changes 👍 Feel free to make a new heading for tags which includes information the user would need to use this feature (i.e. adding tags to a post, adding an optional navigation link to tags page and disabling the feature).
Thanks for this pull request!
_layouts/post.html
Outdated
@@ -9,7 +9,15 @@ <h1 class="title">{{ page.title }}</h1> | |||
{% if page.author %} - {{ page.author }}{% endif %} | |||
</p> | |||
</header> | |||
<section class="post-content">{{ content }}</section> | |||
<section class="post-content"> | |||
{% for tag in page.tags %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tags would be best placed in a new <footer>
HTML element inside the <article>
below the post content, rather than within the post content (.post-content
)
@rohanchandra I'll make the changes as you said but it might take a couple of days, just a bit busy over the weekend. |
For more please see screenshots below. |
Looks great! Thank you for making those changes to the tag design and page. Just two final changes:
Try setting the I want to keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments attached. Thanks!
_sass/layouts/_posts.scss
Outdated
font-size: 0.9em; | ||
display: inline-block; | ||
text-align: center; | ||
.meta { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .meta
rule shouldn't be copied and pasted. Can we refactor the .meta
rule used in the header
instead.
_sass/layouts/_tags.scss
Outdated
margin-top: 0; | ||
margin-bottom: 0; | ||
} | ||
.meta { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse the existing .meta
class styling
tags.html
Outdated
{% for item in (0..site.tags.size) %} | ||
{% unless forloop.last %} | ||
{% capture this_word %}{{ tag_words[item] | strip_newlines }}{% endcapture %} | ||
<a class="button" href="#{{ this_word | cgi_escape }}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button margin isn't consistent with that on the post pages. Please adjust the CSS styles for tags.html
so it has the same margin-right
on the buttons as the post pages.
Done in 5cd1902. |
Done in 4adf5c8. |
Done in de0ad37. |
@rohanchandra Hey! I'm still making a few changes so just wait until I update this regarding the same. Thanks! |
So I think this is done now, just finished up adding some liquid to the posts template to render tag/tags depending on number of tags and also to not render the I'd love to hear your thought on this, so please let me know! And if you can think of anything else we can add on then I can work that out too. |
Great work @divayprakash, this looks really good. Can you update the docs for this feature? I'm thinking info on how to add tags to a post / optional navigation link to tags page (or use of I'll test out your branch for testing and then merge it in after this 👍 |
@rohanchandra I'm using this theme for my blog so I've added category support too in the same manner as tags. The equivalent page for listing the various categories and the posts under them is |
@divayprakash What's the difference between a category and tag? |
|
As the categories change the post url, they provide an easy way to organise posts into folders depending on content or whatever else the author chooses.
Source : Jekyll docs |
Oh cool I didn't know about that. Feel free to make a separate PR for that. |
@divayprakash, did you want to write the docs for this feature? If not, I can write them then merge the feature in. |
@rohanchandra Hey! Sorry about the late response but I got caught up in my brother's wedding and then campus placements. I'd be glad to finish up the docs for this feature but it might take me some time. I hope that's okay. |
@divayprakash No worries 😄! That's totally fine, I'll leave the docs with you |
@rohanchandra I'm extremely sorry for the delay but I won't be able to write the docs after all. If you could go ahead and finish that up then I'll also push the code concerning categories. Cheers! |
@divayprakash No problem, I'll write up the docs soon. Just to confirm the things to note are:
Is there anything else you think I should include? |
Closes #32
Screenshots in comments below