Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bwlng committed Nov 22, 2022
0 parents commit ea0eb08
Show file tree
Hide file tree
Showing 25 changed files with 473 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
content/*
!content/.gitkeep
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Micro.blog

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

99 changes: 99 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"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
},
"ArchiveJSON": {
"mediaType": "application/json",
"path": "archive",
"baseName": "index",
"isPlainText": true,
"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", "ArchiveJSON", "PhotosJSON", "PodcastXML", "PodcastJSON" ],
"page": [ "HTML" ],
"section": [ "HTML" ],
"taxonomy": [ "HTML", "RSS", "JSON" ],
"taxonomyTerm": [ "HTML", "RSS", "JSON" ]
},
"taxonomies": {
"category": "categories"
},
"rssLimit": 25,
"uglyURLs": false,
"blackfriday": {
"fractions": false
},
"markup": {
"goldmark": {
"renderer": {
"unsafe": true
}
}
},
"enableRobotsTXT": true,
"languageCode": "[LANGUAGE]",
"paginate": 25,
"params": {
"description": "Follow <a href=\"https://micro.blog/[USERNAME]\">@[USERNAME] on Micro.blog</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": false,
"paginate_categories": false,
"paginate_replies": false,
"theme_seconds": "0",
"plugins_css": [],
"plugins_js": [],
"plugins_html": []
}
}
3 changes: 3 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
baseURL = 'http://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
Empty file added content/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}
{{ partial "custom_footer.html" . }}
</body>
</html>
23 changes: 23 additions & 0 deletions layouts/_default/list.archivehtml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ define "main" }}

{{ $list := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if gt (len $list) 0 }}
<div class="archive_categories" style="border-bottom: 1px solid lightgray; padding-bottom: 15px; margin-bottom: 30px;">
{{ range $list }}
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
{{ end }}
</div>
{{ end }}

{{ $list := (where .Site.Pages "Type" "post") }}
{{ range $list }}

<p class="h-entry">
<a href="{{ .Permalink }}" class="u-url"><span class="dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">{{ .Date.Format "2006-01-02" }}</span></a>:
<span class="p-name"><b>{{ .Title }}</b></span>
<span class="p-summary">{{ .Summary | truncate 100 }}</span>
</p>

{{ end }}

{{ end }}
17 changes: 17 additions & 0 deletions layouts/_default/list.photoshtml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{ define "main" }}

<div class="photos-grid-container" style="display: grid; grid-column-gap: 15px; grid-row-gap: 15px; grid-template-columns: 33% 33% 33%;">

{{- $list := where .Site.Pages ".Params.photos" "!=" nil -}}
{{- $len := (len $list) -}}
{{ range $index, $value := $list }}
<a href="{{ .Permalink }}">
{{ range first 1 .Params.photos }}
<img src="{{ . }}" width="300" height="300" style="border-radius: 5px; max-width: 100%; height: auto;" class="photos-grid-item" loading="lazy" />
{{ end }}
</a>
{{ end }}

</div>

{{ end }}
25 changes: 25 additions & 0 deletions layouts/_default/rss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<rss version="2.0">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description></description>
{{ with .Site.LanguageCode }}
<language>{{.}}</language>
{{ end }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{ range .Pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
{{- if .Params.guid }}
<guid>{{ .Params.guid }}</guid>
{{- else -}}
<guid>{{ .Permalink }}</guid>
{{- end }}
<description>{{ .Content | html }}</description>
</item>
{{ end }}
</channel>
</rss>
35 changes: 35 additions & 0 deletions layouts/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "https://jsonfeed.org/version/1",
"title": {{ .Site.Title | jsonify }},
"icon": "{{ .Site.Author.avatar }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Site.BaseURL }}feed.json",
"items": [
{{- $list := first 25 (where .Site.Pages "Type" "post") -}}
{{- $len := (len $list) -}}
{{ range $index, $value := $list }}
{
{{ if .Params.guid -}}
"id": "{{ .Params.guid }}",
{{- else -}}
"id": "{{ .Permalink }}",
{{- end }}
{{ if .Title -}}
"title": {{ .Title | jsonify }},
{{- end -}}
{{- $s := .Content | jsonify -}}
{{- $s := replace $s "\\u003c" "<" -}}
{{- $s := replace $s "\\u003e" ">" -}}
{{- $s := replace $s "\\u0026" "&" }}
"content_html": {{ $s }},
"date_published": "{{ .Date.Format "2006-01-02T15:04:05-07:00" }}",
"url": "{{ .Permalink }}"
{{- with .Params.categories -}}
,
"tags": {{ . | jsonify }}
{{- end }}
}
{{- if ne (add $index 1) $len -}},{{- end -}}
{{ end }}
]
}
26 changes: 26 additions & 0 deletions layouts/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<rss version="2.0">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description></description>
{{ with .Site.LanguageCode }}
<language>{{.}}</language>
{{ end }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{- $list := first 25 (where .Site.Pages "Type" "post") -}}
{{ range $list }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
{{- if .Params.guid }}
<guid>{{ .Params.guid }}</guid>
{{- else -}}
<guid>{{ .Permalink }}</guid>
{{- end }}
<description>{{ .Content | html }}</description>
</item>
{{ end }}
</channel>
</rss>
23 changes: 23 additions & 0 deletions layouts/list.archivehtml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ define "main" }}

{{ $list := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if gt (len $list) 0 }}
<div class="archive_categories" style="border-bottom: 1px solid lightgray; padding-bottom: 15px; margin-bottom: 30px;">
{{ range $list }}
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
{{ end }}
</div>
{{ end }}

{{ $list := (where .Site.Pages "Type" "post") }}
{{ range $list }}

<p class="h-entry">
<a href="{{ .Permalink }}" class="u-url"><span class="dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">{{ .Date.Format "2006-01-02" }}</span></a>:
<span class="p-name"><b>{{ .Title }}</b></span>
<span class="p-summary">{{ .Summary | truncate 100 }}</span>
</p>

{{ end }}

{{ end }}
21 changes: 21 additions & 0 deletions layouts/list.archivejson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "https://jsonfeed.org/version/1",
"title": {{ .Site.Title | jsonify }},
"icon": "{{ .Site.Author.avatar }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Site.BaseURL }}photos/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 }}
]
}
17 changes: 17 additions & 0 deletions layouts/list.photoshtml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{ define "main" }}

<div class="photos-grid-container" style="display: grid; grid-column-gap: 15px; grid-row-gap: 15px; grid-template-columns: 33% 33% 33%;">

{{- $list := where .Site.Pages ".Params.photos" "!=" nil -}}
{{- $len := (len $list) -}}
{{ range $index, $value := $list }}
<a href="{{ .Permalink }}">
{{ range first 1 .Params.photos }}
<img src="{{ . }}" width="300" height="300" style="border-radius: 5px; max-width: 100%; height: auto;" class="photos-grid-item" loading="lazy" />
{{ end }}
</a>
{{ end }}

</div>

{{ end }}
31 changes: 31 additions & 0 deletions layouts/list.photosjson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"version": "https://jsonfeed.org/version/1",
"title": {{ .Site.Title | jsonify }},
"icon": "{{ .Site.Author.avatar }}",
"home_page_url": "{{ .Site.BaseURL }}",
"feed_url": "{{ .Site.BaseURL }}photos/index.json",
"items": [
{{- $list := where .Site.Pages ".Params.photos" "!=" nil -}}
{{- $len := (len $list) -}}
{{ range $index, $value := $list }}
{
"id": "{{ .Permalink }}",
"title": {{ .Title | jsonify }},
{{- $s := .Content | jsonify -}}
{{- $s := replace $s "\\u003c" "<" -}}
{{- $s := replace $s "\\u003e" ">" -}}
{{- $s := replace $s "\\u0026" "&" }}
"content_html": {{ $s }},
"date_published": "{{ .Date.Format "2006-01-02T15:04:05-07:00" }}",
"url": "{{ .Permalink }}",
{{ range first 1 .Params.photos }}
"image": "{{ . }}",
"_microblog": {
"thumbnail_url": "https://micro.blog/photos/400/{{ . }}"
}
{{ end }}
}
{{- if ne (add $index 1) $len -}},{{- end -}}
{{ end }}
]
}
Loading

0 comments on commit ea0eb08

Please sign in to comment.