Skip to content

Indexes: add People index #1127

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ defaults:
layout: topic
permalink: /en/topics/:title/
localizable: false
- scope:
path: "_people"
values:
layout: person
permalink: /en/people/:title/
localizable: false

collections:
topics:
output: true
people:
output: true

languages:
- code: ja
Expand Down
6 changes: 6 additions & 0 deletions _includes/optech-mention.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="backlink-box">
<div class="backlink-header">
#{{ reference.newsletter_number }} > {{ reference.header }}{% unless reference.title == nil %} > {{ reference.title }}{% endunless %}
</div>
{{ reference.paragraph | link_to_anchor: reference.url | markdownify }}
</div>
95 changes: 95 additions & 0 deletions _layouts/person.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
layout: post
---
{% capture newline %}
{% endcapture %}
{% capture /dev/null %}
<!-- Get links for previous and next pages -->
{% assign people_list = site.people | natural_sort: "title" %}
{% capture first_link %}[{{people_list[0].title}}]({{people_list[0].url}}){% endcapture %}
{% capture last_link %}[{{people_list[-1].title}}]({{people_list[-1].url}}){% endcapture %}
{% for entry in people_list %}
{% capture entry_link %}[{{entry.title}}]({{entry.url}}){% endcapture %}
{% if prev_link %}
{% assign next_link = entry_link %}
{% break %}
{% endif %}
{% if entry.url == page.url %}
{% assign prev_link = prev_entry | default: last_link %}
{% endif %}
{% assign prev_entry = entry_link %}
{% endfor %}

<!-- Build list of primary sources -->
{% for source in page.primary_sources %}
{%- if source.link contains 'http://' or source.link contains 'https://' -%}
{% capture reference %}[{{source.title}}]({{source.link}}){% endcapture %}
{%- else -%}
{% capture reference %}[{{source.title}}][{{source.link}}]{% endcapture %}
{%- endif -%}
{% capture primary_sources %}{{primary_sources}}{{newline}}- {{reference}}{% endcapture %}
{% endfor %}


<!-- Build list of see also entries -->
{% for source in page.see_also %}
{%- if source.link contains 'http://' or source.link contains 'https://' -%}
{% capture reference %}[{{source.title}}]({{source.link}}){% endcapture %}
{%- else -%}
{% capture reference %}[{{source.title}}][{{source.link}}]{% endcapture %}
{%- endif -%}
{% capture see_also %}{{see_also}}{{newline}}- {{reference}}{% endcapture %}
{% endfor %}

<!-- Variable for use in links -->
{% capture gh_base %}https://github.com/{{site.github_username}}/{{site.repository_name}}{% endcapture %}

{% endcapture %}

<!-- Actual page content -->
{% capture content %}
{% include references.md %}
{{aliases}}

{{page.excerpt}}

{{page.content}}

{{notices | default: newline}}

{%- if page.podcast_mentions.size > 0 -%}
## Optech podcast appearances

{%- for mention in page.podcast_mentions -%}
{{newline}}- [{{mention.title}}]({{mention.url}})
{%- endfor -%}
{% endif %}{{newline}}{{newline}}

{%- if page.optech_mentions and page.optech_mentions != '' -%}
## Optech newsletter mentions

{% assign sorted_references = page.optech_mentions | sort_by_newsletter_number | reverse %}
{%- for reference in sorted_references -%}
{%- assign current_ref_year = reference.year -%}
{%- if current_ref_year != last_ref_year -%}
{{newline}}{{newline}}**{{current_ref_year}}**
{%- endif -%}
{{newline}}{% include optech-mention.html %}
{%- assign last_ref_year = current_ref_year -%}
{%- endfor -%}
{% endif %}{{newline}}{{newline}}

{%- if page.see_also and page.see_also != '' -%}
## See also

{{see_also}}
{% endif %}

<br>{{newline}}{{newline}}
<span class="float-left" markdown="1">**Previous Person:**<br>{{prev_link}}</span>
<span class="float-right" markdown="1">**Next Person:**<br>{{next_link | default: first_link }}</span>

{:.center}
[Edit page]({{gh_base}}/edit/master/{{page.path}})<br>
[Report Issue]({{gh_base}}/issues/new?body={{'Source file: ' | append: page.path | url_escape }})
{% endcapture %}{{ content | markdownify }}
3 changes: 3 additions & 0 deletions _people/en/ZmnSCPxj.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: ZmnSCPxj
---
3 changes: 3 additions & 0 deletions _people/en/bastien-teinturier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Bastien Teinturier
---
3 changes: 3 additions & 0 deletions _people/en/carla-kirk-cohen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Carla Kirk-Cohen
---
3 changes: 3 additions & 0 deletions _people/en/clara-shikhelman.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Clara Shikhelman
---
3 changes: 3 additions & 0 deletions _people/en/dan-gould.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Dan Gould
---
3 changes: 3 additions & 0 deletions _people/en/larry-ruane.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Larry Ruane
---
23 changes: 22 additions & 1 deletion _plugins/auto-anchor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# - [Summary][]: Details
# - [Summary](URL): Details

def generate_anchor_list_link(anchor_link)
# custom clickable bullet linking to an anchor
"<a href=\"#{anchor_link}\" class=\"anchor-list-link\">●</a>"
end

def auto_anchor(content)
content.gsub!(/^ *- .*/) do |string|
## Find shortest match for **bold**, *italics*, or [markdown][links]
Expand All @@ -17,7 +22,7 @@ def auto_anchor(content)
string
else
slug = generate_slug(title)
id_prefix = "- {:#{slug} .anchor-list} <a href=\"#{slug}\" class=\"anchor-list-link\">●</a>"
id_prefix = "- {:#{slug} .anchor-list} #{generate_anchor_list_link(slug)}"
string.sub!(/-/, id_prefix)
end
end
Expand Down Expand Up @@ -49,3 +54,19 @@ def render(context)

Liquid::Template.register_tag('auto_anchor', Jekyll::RenderAutoAnchor)

module TextFilter
# This is a custom filter used in `optech-mentions.html`
# to add anchor links to each backlink snippet
def link_to_anchor(text, url)
id_prefix = generate_anchor_list_link(url)
if text.start_with?("-")
# snippet is already a list item
text.sub!(/-/, id_prefix)
else
text.prepend("#{id_prefix} ")
end
text
end
end

Liquid::Template.register_filter(TextFilter)
Loading