Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hugo.Context #12761

Closed
bep opened this issue Aug 14, 2024 · 1 comment
Closed

Add hugo.Context #12761

bep opened this issue Aug 14, 2024 · 1 comment
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Aug 14, 2024

The needs for this proposal comes from trying to find an easy way to test the scoped rendering support in #12759 -- and instead of making it some internal magic, I thought we expose it in the API, because it's obviously useful.

I'm not totally convinced that the hugo.Context is a correct placement, so happy to take suggestions.

The import part here is that the data available in hugo.Context is local to the current render, so it's perfectly thread safe.

The first thing I want to put in there is MarkupScope, so you could e.g. do:

{{ if eq hugo.Context.MarkupScope "home" }}
{{ end }}
@bep bep added the Proposal label Aug 14, 2024
@bep bep self-assigned this Aug 14, 2024
@bep bep added this to the v0.133.0 milestone Aug 14, 2024
@bep bep pinned this issue Aug 14, 2024
bep added a commit to bep/hugo that referenced this issue Aug 14, 2024
bep added a commit to bep/hugo that referenced this issue Aug 14, 2024
bep added a commit to bep/hugo that referenced this issue Aug 16, 2024
@bep bep added Enhancement and removed Proposal labels Aug 16, 2024
bep added a commit to bep/hugo that referenced this issue Aug 17, 2024
bep added a commit to bep/hugo that referenced this issue Aug 23, 2024
bep added a commit to bep/hugo that referenced this issue Aug 25, 2024
bep added a commit to bep/hugo that referenced this issue Aug 28, 2024
bep added a commit to bep/hugo that referenced this issue Aug 28, 2024
bep added a commit to bep/hugo that referenced this issue Aug 28, 2024
bep added a commit to bep/hugo that referenced this issue Aug 28, 2024
bep added a commit to bep/hugo that referenced this issue Aug 28, 2024
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
bep added a commit to bep/hugo that referenced this issue Aug 29, 2024
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes gohugoio#8680
Fixes gohugoio#12761
Fixes gohugoio#12778
Fixes gohugoio#716
@bep bep closed this as completed in 3760926 Aug 29, 2024
@bep bep removed this from the v0.133.0 milestone Aug 29, 2024
@bep bep added this to the v0.134.0 milestone Aug 29, 2024
@bep bep unpinned this issue Aug 29, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant