Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Murukesh Mohanan
web
Commits
ac53bcf0
Commit
ac53bcf0
authored
May 21, 2017
by
Murukesh Mohanan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate pages for tags
parent
8b13f644
Pipeline
#1184
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
1 deletion
+90
-1
_config.yml
_config.yml
+2
-1
_layouts/tag.html
_layouts/tag.html
+43
-0
_plugins/tag_gen.rb
_plugins/tag_gen.rb
+35
-0
styles/tag.css
styles/tag.css
+10
-0
No files found.
_config.yml
View file @
ac53bcf0
...
...
@@ -26,6 +26,7 @@ pages_list:
Resources
:
'
resources'
Blog
:
'
blog'
exclude
:
[
vendor
,
"
Gemfile"
,
"
Gemfile.lock"
]
exclude
:
[
vendor
,
"
Gemfile"
,
"
Gemfile.lock"
,
"
README.md"
,
"
LICENSE"
]
paginate
:
5
paginate_path
:
"
/blog/page:num/"
future
:
true
_layouts/tag.html
0 → 100644
View file @
ac53bcf0
---
title: Tag
pagestyle: tag
layout: default
---
{% assign tag = site.data.tags[page.tag] %}
<section
class=
"tag-title"
>
<header>
<h1>
{{ tag.name }}
</h1>
</header>
<hr>
{{ tag.desc }}
</section>
{% for post in site.posts %}
{% if post.tags contains page.tag %}
<section
class=
"post"
>
<header
class=
"post-title"
>
<h1>
<a
href=
"{{site.base-url}}{{ post.url }}#main"
>
{{ post.title }}
</a>
<time
datetime=
"{{ post.date | date_to_xmlschema }}"
class=
"post-date"
>
{{ post.date | date: "%B %e, %Y" }}
</time>
{% if post.tags.size > 0 %}
</h1>
<ol
class=
"tags-list"
>
{% for post_tag in post.tags %}
{% assign tag = site.data.tags[post_tag] %}
{% if tag %}
<li><a
class=
"tag"
href=
"/blog/tag/{{ post_tag }}/"
>
{{ tag.name }}
</a></li>
{% endif %}
{% endfor %}
</ol>
{% endif %}
</header>
<hr>
{{ post.excerpt }}
</section>
{% endif %}
{% endfor %}
_plugins/tag_gen.rb
0 → 100644
View file @
ac53bcf0
# Thanks to http://charliepark.org/tags-in-jekyll/
module
Jekyll
class
TagIndex
<
Page
def
initialize
(
site
,
base
,
dir
,
tag
)
@site
=
site
@base
=
base
@dir
=
dir
@name
=
'index.html'
self
.
process
(
@name
)
self
.
read_yaml
(
File
.
join
(
base
,
'_layouts'
),
'tag.html'
)
self
.
data
[
'tag'
]
=
tag
tag_title_prefix
=
site
.
config
[
'tag_title_prefix'
]
||
'Posts Tagged “'
tag_title_suffix
=
site
.
config
[
'tag_title_suffix'
]
||
'”'
self
.
data
[
'title'
]
=
"
#{
tag_title_prefix
}#{
tag
}#{
tag_title_suffix
}
"
end
end
class
TagGenerator
<
Generator
safe
true
def
generate
(
site
)
if
site
.
layouts
.
key?
'tag'
dir
=
site
.
config
[
'tag_dir'
]
||
'blog/tag'
site
.
data
[
'tags'
].
each
do
|
tag
,
val
|
write_tag_index
(
site
,
File
.
join
(
dir
,
tag
),
tag
)
end
end
end
def
write_tag_index
(
site
,
dir
,
tag
)
index
=
TagIndex
.
new
(
site
,
site
.
source
,
dir
,
tag
)
index
.
render
(
site
.
layouts
,
site
.
site_payload
)
index
.
write
(
site
.
dest
)
site
.
pages
<<
index
end
end
end
styles/tag.css
0 → 100644
View file @
ac53bcf0
@import
'posts.css'
;
section
.post
{
background-color
:
#8598a2
;
color
:
white
;
}
section
.post
>
header
>
h1
>
a
:link
,
section
.post
>
header
>
h1
>
a
:visited
{
color
:
honeydew
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment