Let me start with an incidental:
Either I found a copy/paste artifact on line 6 of layouts/list.archivejson.json
of the blank (and therefore base) template or I have lost my mind.
"feed_url": "{{ .Site.BaseURL }}photos/index.json"
Okay, the meat. I have come to the point where I need someone inside the black box to tell me why creating a custom JSON output is not working. I mirrored the PhotosJSON
target (which seemed like a good idea as the copy/past artifact would indicate that you did as well).
I totally have a valid file at https://moondeer.blog/photos/index.json
.
I totally have a valid file at https://moondeer.blog/archive/index.json
.
So ā¦ why TF do I have no valid file at https://moondeer.blog/crossing/index.json
?
Here comes the relevant file code:
My customized config.json
(which, just to be sure I was dotting all the 'iās, is a full copy of the blank theme config.json
with some false
s set to true
s, pagination set to 10
, and the mirrored output format, additional format added to home
.
{
"title": "[TITLE]",
"author": {
"name": "[FULL_NAME]",
"avatar": "https://micro.blog/[USERNAME]/avatar.jpg",
"username": "[USERNAME]"
},
"baseURL": "[SCHEME]://[HOSTNAME]/",
"mediaTypes": {
"application/json": {
"suffixes": [ "json" ]
}
},
"outputFormats": {
"RSS": {
"baseName": "feed"
},
"JSON": {
"baseName": "feed"
},
"RSD": {
"mediaType": "application/xml",
"baseName": "rsd",
"isPlainText": true,
"notAlternative": true
},
"ArchiveHTML": {
"mediaType": "text/html",
"path": "archive",
"baseName": "index",
"isPlainText": false,
"notAlternative": true
},
"ArchiveJSON": {
"mediaType": "application/json",
"path": "archive",
"baseName": "index",
"isPlainText": true,
"notAlternative": true
},
"CrossingJSON": {
"mediaType": "application/json",
"path": "crossing",
"baseName": "index",
"isPlainText": true,
"notAlternative": true
},
"PhotosHTML": {
"mediaType": "text/html",
"path": "photos",
"baseName": "index",
"isPlainText": false,
"notAlternative": true
},
"PhotosJSON": {
"mediaType": "application/json",
"path": "photos",
"baseName": "index",
"isPlainText": true,
"notAlternative": true
},
"PodcastXML": {
"mediaType": "application/rss+xml",
"baseName": "podcast",
"isPlainText": true,
"notAlternative": true
},
"PodcastJSON": {
"mediaType": "application/json",
"baseName": "podcast",
"isPlainText": true,
"notAlternative": true
}
},
"outputs": {
"home": [ "HTML", "RSS", "JSON", "RSD", "ArchiveHTML", "ArchiveJSON", "PhotosJSON", "PodcastXML", "PodcastJSON", "CrossingJSON" ],
"page": [ "HTML" ],
"section": [ "HTML" ],
"taxonomy": [ "HTML", "RSS", "JSON" ],
"taxonomyTerm": [ "HTML", "RSS", "JSON" ]
},
"taxonomies": {
"category": "categories"
},
"rssLimit": 25,
"uglyURLs": false,
"blackfriday": {
"fractions": false
},
"enableRobotsTXT": true,
"languageCode": "[LANGUAGE]",
"paginate": 10,
"params": {
"description": "<a href=\"https://micro.blog/[USERNAME]\">@[USERNAME]</a>",
"itunes_description": "[ITUNES_DESCRIPTION]",
"itunes_category": "[ITUNES_CATEGORY]",
"itunes_subcategory": "[ITUNES_SUBCATEGORY]",
"itunes_author": "[ITUNES_AUTHOR]",
"itunes_email": "[ITUNES_EMAIL]",
"itunes_cover": "[ITUNES_COVER]",
"twitter_username": "[TWITTER_USERNAME]",
"github_username": "[GITHUB_USERNAME]",
"instagram_username": "[INSTAGRAM_USERNAME]",
"site_id": "[SITE_ID]",
"paginate_home": true,
"paginate_categories": true,
"paginate_replies": false,
"theme_seconds": "0",
"plugins_css": [],
"plugins_js": [],
"plugins_html": []
}
}
and here is the template for the custom target: layouts/list.crossingjson.json
. It is literally a copy/past of layouts/list.archivejson.json
with (ironically) photos
swapped out for crossing
.
{
"version": "https://jsonfeed.org/version/1",
"title": {{ .Site.Title | jsonify }},
"icon": "{{ .Site.Author.avatar }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Site.BaseURL }}crossing/index.json",
"items": [
{{- $list := (where .Site.Pages "Type" "post") -}}
{{- $len := (len $list) -}}
{{ range $index, $value := $list }}
{
"id": "{{ .Permalink }}",
"title": {{ .Title | jsonify }},
"content_text": {{ .Summary | truncate 100 | jsonify }},
"date_published": "{{ .Date.Format "2006-01-02T15:04:05-07:00" }}",
"url": "{{ .Permalink }}"
}
{{- if ne (add $index 1) $len -}},{{- end -}}
{{ end }}
]
}
All I need is a fix for getting the template generating a file or to be told to give up. The goal is to be selective about what is being cross-posted to other sites. The only feed I can get to do anything is https://moondeer.blog/feed.json
. Adding a valid category-specific RSS feed does not appear to actually generate any cross-posting activity.