"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hugolib/embedded_templates_test.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

embedded_templates_test.go  (hugo-0.80.0):embedded_templates_test.go  (hugo-0.81.0)
skipping to change at line 18 skipping to change at line 18
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package hugolib package hugolib
import ( import (
"testing" "testing"
qt "github.com/frankban/quicktest"
) )
func TestInternalTemplatesImage(t *testing.T) { func TestInternalTemplatesImage(t *testing.T) {
config := ` config := `
baseURL = "https://example.org" baseURL = "https://example.org"
[params] [params]
images=["siteimg1.jpg", "siteimg2.jpg"] images=["siteimg1.jpg", "siteimg2.jpg"]
` `
skipping to change at line 80 skipping to change at line 82
<meta property="og:image" content="https://example.org/pageimg2.jpg" /> <meta property="og:image" content="https://example.org/pageimg2.jpg" />
<meta itemprop="image" content="https://example.org/pageimg1.jpg"> <meta itemprop="image" content="https://example.org/pageimg1.jpg">
<meta itemprop="image" content="https://example.org/pageimg2.jpg"> <meta itemprop="image" content="https://example.org/pageimg2.jpg">
`) `)
b.AssertFileContent("public/mysite/index.html", ` b.AssertFileContent("public/mysite/index.html", `
<meta name="twitter:image" content="https://example.org/siteimg1.jpg"/> <meta name="twitter:image" content="https://example.org/siteimg1.jpg"/>
<meta property="og:image" content="https://example.org/siteimg1.jpg"/> <meta property="og:image" content="https://example.org/siteimg1.jpg"/>
<meta itemprop="image" content="https://example.org/siteimg1.jpg"/> <meta itemprop="image" content="https://example.org/siteimg1.jpg"/>
`) `)
} }
// Just some simple test of the embedded templates to avoid
// https://github.com/gohugoio/hugo/issues/4757 and similar.
func TestEmbeddedTemplates(t *testing.T) {
t.Parallel()
c := qt.New(t)
c.Assert(true, qt.Equals, true)
home := []string{"index.html", `
GA:
{{ template "_internal/google_analytics.html" . }}
GA async:
{{ template "_internal/google_analytics_async.html" . }}
Disqus:
{{ template "_internal/disqus.html" . }}
`}
b := newTestSitesBuilder(t)
b.WithSimpleConfigFile().WithTemplatesAdded(home...)
b.Build(BuildCfg{})
// Gheck GA regular and async
b.AssertFileContent("public/index.html",
"'anonymizeIp', true",
"'script','https://www.google-analytics.com/analytics.js','ga');\
n\tga('create', 'ga_id', 'auto')",
"<script async src='https://www.google-analytics.com/analytics.js
'>")
// Disqus
b.AssertFileContent("public/index.html", "\"disqus_shortname\" + '.disqus
.com/embed.js';")
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)