diff --git a/items/location/redirections.conf b/items/location/redirections.conf index 7c67e58b..1303e990 100644 --- a/items/location/redirections.conf +++ b/items/location/redirections.conf @@ -56,7 +56,7 @@ location = <%= path_to(linked_data).sub(/\.ttl$/, '') %> { # Content negotiation for personal profile pages ### -<% @items.find_all("#{@config[:static_root]}#{@config[:people][:page_path]}/*/index.*").each do |profile| %> +<% @items.find_all("#{@config[:static_root]}#{@config[:people_root]}/*/index.*").each do |profile| %> location <%= path_to(profile) %> { add_header Vary $vary_header; add_header Cache-Control $cache_control; diff --git a/lib/data_sources/people.rb b/lib/data_sources/people.rb index 6780a1ae..3eedd888 100644 --- a/lib/data_sources/people.rb +++ b/lib/data_sources/people.rb @@ -36,7 +36,7 @@ def person_to_item(person) new_item( person[:name], attributes.merge(person), - Nanoc::Identifier.new("/people/_#{slug}"), + Nanoc::Identifier.new("/_#{slug}"), attributes_checksum_data: Digest::SHA1.digest(Marshal.dump(person)), ) end diff --git a/lib/helpers/company.rb b/lib/helpers/company.rb index 0f04114c..ff38bd4e 100644 --- a/lib/helpers/company.rb +++ b/lib/helpers/company.rb @@ -65,7 +65,7 @@ def member?(member) # @return [void] def populate_member_identifiers members.each do |member| - member[:web_id] ||= "#{@config[:base_url]}#{@config[:people][:page_path]}/#{member.fetch(:slug)}/##{member.fetch(:hashtag, 'me')}" + member[:web_id] ||= "#{@config[:base_url]}#{@config[:people_root]}/#{member.fetch(:slug)}/##{member.fetch(:hashtag, 'me')}" end end @@ -79,7 +79,7 @@ def generate_personal_profile_pages @items.create( %(<%= render('/personal_profile.*', person_name: '#{member[:name]}') %>), { title: member[:name], kind: 'personal-profile-page', description: "Personal profile of #{member[:name]}" }, - "#{@config[:static_root]}#{@config[:people][:page_path]}/#{member.fetch(:slug)}/index.erb", + "#{@config[:static_root]}#{@config[:people_root]}/#{member.fetch(:slug)}/index.erb", binary: false, ) end diff --git a/lib/helpers/people.rb b/lib/helpers/people.rb index 70475206..ec18f1be 100644 --- a/lib/helpers/people.rb +++ b/lib/helpers/people.rb @@ -50,7 +50,7 @@ def person_by_name(name) def path_to_profile_page(person, absolute: false) web_id = person.fetch(:web_id).to_s if member?(person) - profile_page_item = @items["#{@config[:static_root]}#{@config[:people][:page_path]}/#{person.fetch(:slug)}/index.*"] + profile_page_item = @items["#{@config[:static_root]}#{@config[:people_root]}/#{person.fetch(:slug)}/index.*"] path_to(profile_page_item, absolute: absolute) elsif web_id.start_with?(@config[:base_url]) path_to(web_id, absolute: absolute) @@ -72,7 +72,7 @@ def path_to_profile_page(person, absolute: false) # @return [void] def populate_people_identifiers @items.find_all('/people/_*').each do |person| - person[:web_id] ||= "#{@config[:base_url]}#{@config[:people][:page_path]}##{person.fetch(:slug)}" + person[:web_id] ||= "#{@config[:base_url]}#{@config[:people_root]}##{person.fetch(:slug)}" end end end diff --git a/nanoc.yaml b/nanoc.yaml index bd74296f..8dc82359 100644 --- a/nanoc.yaml +++ b/nanoc.yaml @@ -63,6 +63,7 @@ data_sources: - type: people people_data: 'etc/people.yaml' + items_root: &people_root /people # Config for Nanoc environments @@ -84,8 +85,8 @@ environments: cache: short_urls: 'var/short_urls.yaml' - company: - page_path: /company + company_root: /company + people_root: *people_root erb: trim_mode: '>' @@ -96,9 +97,6 @@ environments: tag_url: "https://github.com/pentandra/lifepreserver/releases/tag" version_history_url: "https://github.com/lifepreserver/commits/master" - people: - page_path: /people - site: &site name: Pentandra motto: Breaking Research Barriers