How to use replace function with double quote wrapped


#1

Help.
[{{ range $index, $page := .Site.Pages }}{{ if $page.Title }}{{ if $index }},{{ end }}
{“url”: “{{ $page.Permalink }}”,
“title”: “{{ $page.Title }}”,
“content”: “{{ $page.PlainWords | replace “” “” }}”}{{ end }}{{ end }}]

never work.
question 1, can i use replace PlainWords(which generate slice?) / or use Plain and then remove all new line ?
question 2expression like “{{ .Content|replace “xx” “” }}” validate?

Thanks~


#2

I’m a bit confused since your code snippet was processed with markdown (for future reference: https://github.github.com/gfm/#fenced-code-blocks). You want to replace "" with "? If so, I believe

{{ $page.PlainWords | replace "\"\"" "\"" }}

should do the trick.