Skip to content

Commit

Permalink
Merge branch 'master' into multilang-2020-11-27
Browse files Browse the repository at this point in the history
  • Loading branch information
lomion0815 authored Dec 9, 2020
2 parents 2e0a8c6 + 9e4dd68 commit ac399da
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ If you want to enable google analytics when running hugo as server, add `enableG
enableGoogleAnalytics = true
```

#### Enable UglyURLs

If you want to enable "Ugly URLs" (e.g. exmaple.com/urls.html), add `uglyurls = true` to top level and [params] of your config.toml.

```
uglyurls = true
[params]
uglyurls = true
```

## Frontmatter example

```
Expand Down Expand Up @@ -221,4 +232,4 @@ $ npm run build-prod
[MIT](./LICENSE).


[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmatsuyoshi30%2Fharbor.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmatsuyoshi30%2Fharbor?ref=badge_large)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmatsuyoshi30%2Fharbor.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmatsuyoshi30%2Fharbor?ref=badge_large)
12 changes: 12 additions & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,28 @@
<ul class="pager">
{{ if .Paginator.HasPrev }}
<li class="previous">
{{ if $.Site.Params.uglyurls }}
<a href="{{ replaceRE "\\.html$" "/" .Permalink }}page/{{ .Paginator.Prev.PageNumber }}.html"
>&larr; {{ i18n "newer" }}</a
>
{{ else }}
<a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}/"
>&larr; {{ i18n "newer" }}</a
>
{{ end }}
</li>
{{ end }}
{{ if .Paginator.HasNext }}
<li class="next">
{{ if $.Site.Params.uglyurls }}
<a href="{{ replaceRE "\\.html$" "/" .Permalink }}page/{{ .Paginator.Next.PageNumber }}.html"
>{{ i18n "older" }} &rarr;</a
>
{{ else }}
<a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}/"
>{{ i18n "older" }} &rarr;</a
>
{{ end }}
</li>
{{ end }}
</ul>
Expand Down
3 changes: 1 addition & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
{{ if .Params.tags }}
<div class="blog-tags">
{{ range .Params.tags }}
<a href="{{ "" | absLangURL }}/tags/{{ . | urlize }}/">{{ . }}</a
<a href="{{ "" | absLangURL }}tags/{{ . | urlize }}{{ if $.Site.Params.uglyurls }}.html{{else}}/{{ end }}">{{ . }}</a
>&nbsp;
<a href="{{ "" | absLangURL }}/tags/{{ . | urlize }}/">{{ . }}</a>&nbsp;
{{ end }}
</div>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/postmeta.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ if .Params.categories }}
&nbsp;&nbsp;&nbsp;<em class="fa fa-folder-open"></em>&nbsp;
{{ range .Params.categories }}
<a href="{{ $.Site.BaseURL }}/categories/{{ . | urlize }}/">{{ . }}</a
<a href="{{ $.Site.BaseURL }}categories/{{ . | urlize }}{{ if $.Site.Params.uglyurls }}.html{{else}}/{{ end }}">{{ . }}</a
>&nbsp;
{{ end }}
{{ end }}
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
}
},
"lint-staged": {
"!(bundle).{js,html}": [
"prettier-eslint --write $PWD/'static/src/**/*.js $PWD/'layouts/**/*.html'",
"!(bundle).html": [
"prettier-eslint --write $PWD/'static/src/**/*.js $PWD/'layouts/**/*.html'"
],
"!(bundle).js": [
"eslint $PWD/'static/src/**/*.js'"
]
}
Expand Down

0 comments on commit ac399da

Please sign in to comment.