Фикс урлов для блога
This commit is contained in:
parent
11bb56301c
commit
6e81c3dca4
6 changed files with 12 additions and 12 deletions
14
README.md
14
README.md
|
@ -1,5 +1,5 @@
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/n0x1m/hugoext)](https://goreportcard.com/report/github.com/n0x1m/hugoext)
|
[![Go Report Card](https://goreportcard.com/badge/gitrepo.ru/neonxp/hugoext)](https://goreportcard.com/report/gitrepo.ru/neonxp/hugoext)
|
||||||
[![GoDoc](https://godoc.org/github.com/n0x1m/hugoext?status.svg)](https://godoc.org/github.com/n0x1m/hugoext)
|
[![GoDoc](https://godoc.org/gitrepo.ru/neonxp/hugoext?status.svg)](https://godoc.org/gitrepo.ru/neonxp/hugoext)
|
||||||
|
|
||||||
# hugoext
|
# hugoext
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ unmodified.
|
||||||
|
|
||||||
## Example Use
|
## Example Use
|
||||||
|
|
||||||
Using the [md2gmi](https://github.com/n0x1m/md2gmi) command line utility to convert markdown to
|
Using the [md2gmi](https://gitrepo.ru/neonxp/md2gmi) command line utility to convert markdown to
|
||||||
gemtext. Executed from the hugo directory:
|
gemtext. Executed from the hugo directory:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -57,21 +57,21 @@ page = ":filename"
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
go install github.com/n0x1m/hugoext@latest
|
go install gitrepo.ru/neonxp/hugoext@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
To use the gemini file server and markdown to gemtext converter in the examples below, also install
|
To use the gemini file server and markdown to gemtext converter in the examples below, also install
|
||||||
these:
|
these:
|
||||||
|
|
||||||
```
|
```
|
||||||
go install github.com/n0x1m/md2gmi@latest
|
go install gitrepo.ru/neonxp/md2gmi@latest
|
||||||
go install github.com/n0x1m/gmifs@latest
|
go install gitrepo.ru/neonxp/gmifs@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Development
|
### Development
|
||||||
|
|
||||||
To test the extension in a similar fashion to the hugo workflow, use a server to host the static
|
To test the extension in a similar fashion to the hugo workflow, use a server to host the static
|
||||||
files. Here an example for a Gemlog using [gmifs](https://github.com/n0x1m/gmifs) in a makefile:
|
files. Here an example for a Gemlog using [gmifs](https://gitrepo.ru/neonxp/gmifs) in a makefile:
|
||||||
|
|
||||||
```makefile
|
```makefile
|
||||||
serve:
|
serve:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/n0x1m/hugoext/hugo"
|
"gitrepo.ru/neonxp/hugoext/hugo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileTree struct {
|
type FileTree struct {
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/n0x1m/hugoext
|
module gitrepo.ru/neonxp/hugoext
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ func pageToPermalinkSlugElseTitle(m *PageMetadata, a string) (string, error) {
|
||||||
|
|
||||||
// pageToPermalinkFilename returns the URL-safe form of the filename
|
// pageToPermalinkFilename returns the URL-safe form of the filename
|
||||||
func pageToPermalinkFilename(m *PageMetadata, _ string) (string, error) {
|
func pageToPermalinkFilename(m *PageMetadata, _ string) (string, error) {
|
||||||
return URLEscape(m.Filepath)
|
return strings.ToLower(strings.ReplaceAll(m.Filepath, " ", "-")), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func pageToPermalinkTitle(m *PageMetadata, _ string) (string, error) {
|
func pageToPermalinkTitle(m *PageMetadata, _ string) (string, error) {
|
||||||
|
|
2
main.go
2
main.go
|
@ -8,7 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/n0x1m/hugoext/hugo"
|
"gitrepo.ru/neonxp/hugoext/hugo"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/n0x1m/hugoext/hugo"
|
"gitrepo.ru/neonxp/hugoext/hugo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewContentFromMeta(meta map[string]interface{}) *hugo.PageMetadata {
|
func NewContentFromMeta(meta map[string]interface{}) *hugo.PageMetadata {
|
||||||
|
|
Loading…
Reference in a new issue