liquid-utilities / liquid-utilities/feed-json

`absolute_url` fails silently when `permalink` is defined

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Liquid
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Describe the bug

When `post.id` is undefined, the `post.url` filtered through `absolute_url` should be used. Branching via `if`/`else` functions as intended, however, for unknown reasons the `absolute_url` Jekyll filter is failing to produce a full URL. Instead only the collection name and post slug survives.

This seems to be some kind of bug that is triggered when `permalink` is defined/configured.

______

## Example Setup

`_config.yml` (snip)

```yaml
url: 'https://liquid-utilities.github.io'

collections_dir: documentation
collections:
example-collection:
output: true
permalink: /:collection/:name/
```

---

`_layout/test-absolute-url.html`

```liquid
{% assign collection__data = collection[page.collection_name] %}
{% for post in collection__data %}
URL: {{ post.url | absolute_url }}
{% endfor %}
```

---

`documentation/_exapmple-collection/test-absolute-url.md`

```markdown
---
layout: post
title: Tests Absolute URL Filter
description: Example post that collection layout will fail to parse URL for
---
```

---

`example-collection.html`

```html
---
layout: test-absolute-url
collection_name: example-collection
---
```

______

## Example Results

Build then navigate to example-collection URL similar to; `https://.github.io//example-collection.html`

Output will likely be presented similar to...

```text
URL: /example-collection/test-absolute-url
```

______

## Expected Behavior

Output _should_ be presented similar to...

```text
URL: https://.github.io//example-collection/test-absolute-url
```

... this is what `feed-atom` and `feed-rss2` layouts from `liquid-utilities` achieve, and there doesn't appear to be any major differences in how `post.url` is filtered by `absolute_url`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the build with `_config.yml`, `_layout/test-absolute-url.html`, and the example collection files shown in the report. Compare the generated `post.url | absolute_url` output with the expected full URL, then verify the fix against the collection permalink setup and the feed layouts mentioned.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.