Skip to content

Commit

Permalink
/api/v1/ rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
marcwrobel committed Dec 22, 2022
1 parent 8208536 commit 1e35540
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions _plugins/generate-api-v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(site, product)
@site = site
@base = site.source
@dir = "api/v1/#{id}"
@name = "info.json"
@name = "index.json"

@data = {}.merge(product.data)
@data.delete('permalink') # path already configured above, must not be overridden
Expand All @@ -56,7 +56,7 @@ def initialize(site, all_products)
@site = site
@base = site.source
@dir = 'api/v1'
@name = "all.json"
@name = "index.json"

@data = {}
@data['layout'] = 'v1_all_products'
Expand Down
5 changes: 4 additions & 1 deletion _redirects
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
# Setting a layout forces Jekyll to render this file
layout: null
---
{%- for page in site.pages -%}
# Rewrite for /api/v1/
/api/v1/ /api/v1/index.json 200!

{% for page in site.pages -%}
# Redirects for {{page.path}}
{%- if page.alternate_urls %}
{%- for url in page.alternate_urls %}
Expand Down

0 comments on commit 1e35540

Please sign in to comment.