Skip to content

Commit

Permalink
fix: fix paths of robots.txt and sitemap.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhsudhir committed Apr 2, 2024
1 parent bc9caab commit c152bf8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 33 deletions.
4 changes: 2 additions & 2 deletions cmd/anna/anna.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ func (cmd *Cmd) VanillaRender() {
fileSystem := os.DirFS(helpers.SiteDataPath + "content/")
p.ParseMDDir(helpers.SiteDataPath+"content/", fileSystem)

p.ParseRobots(helpers.SiteDataPath+"layout/robots.txt", helpers.SiteDataPath+"rendered/layout/robots.txt")
p.ParseRobots(helpers.SiteDataPath+"layout/robots.txt", helpers.SiteDataPath+"rendered/robots.txt")
p.ParseLayoutFiles()

e.Templates = p.Templates
e.TagsMap = p.TagsMap
e.LayoutConfig = p.LayoutConfig
e.Posts = p.Posts

e.GenerateSitemap(helpers.SiteDataPath + "rendered/layout/sitemap.xml")
e.GenerateSitemap(helpers.SiteDataPath + "rendered/sitemap.xml")
e.GenerateFeed()
e.GenerateJSONIndex(helpers.SiteDataPath)
helper.CopyDirectoryContents(helpers.SiteDataPath+"static/", helpers.SiteDataPath+"rendered/static/")
Expand Down
48 changes: 22 additions & 26 deletions site/layout/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
{{define "head"}}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{.Frontmatter.Title}}</title>

<link rel="preload stylesheet" href="{{.Layout.ThemeURL}}" />
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js"></script>
<link
rel="alternate"
type="application/atom+xml"
title="feed"
href="/feed.atom"
/>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{.Frontmatter.Title}}</title>

{{range .Frontmatter.JSFiles}}
<script src="/script/{{.}}" defer></script>
{{end}} {{range .Layout.SiteScripts}}
<script src="/script/{{.}}" defer></script>
{{end}}
<link rel="preload stylesheet" href="{{.Layout.ThemeURL}}" />
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js"></script>
<link rel="alternate" type="application/atom+xml" title="feed" href="/feed.atom" />

<meta property="og:type" content="website" />
<meta property="og:title" content="{{ .Frontmatter.Title }}" />
<meta
property="og:description"
content="{{ .Frontmatter.Description }}"
/>
<meta property="og:image" content="{{ .Frontmatter.PreviewImage }}" />
</head>
{{range .Frontmatter.JSFiles}}
<script src="/script/{{.}}" defer></script>
{{end}} {{range .Layout.SiteScripts}}
<script src="/script/{{.}}" defer></script>
{{end}}
</html>

<meta property="og:type" content="website" />
<meta property="og:title" content="{{ .Frontmatter.Title }}" />
<meta property="og:description" content="{{ .Frontmatter.Description }}" />
<meta property="og:image" content="{{ .Frontmatter.PreviewImage }}" />

<meta name="description" content="{{ .Frontmatter.Description }}">
</head>
{{end}}

</html>
1 change: 0 additions & 1 deletion site/static/index.json

This file was deleted.

1 change: 0 additions & 1 deletion test/engine/render_user_defined/rendered/.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
<h1>Index Page</h1>
</body>
</html>

6 changes: 3 additions & 3 deletions test/engine/sitemap/got_sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>example.org/index.html</loc>
<loc>example.org/about.html</loc>
<lastmod>2024-02-23</lastmod>
</url>
<url>
<loc>example.org/research.html</loc>
<loc>example.org/index.html</loc>
<lastmod>2024-02-23</lastmod>
</url>
<url>
<loc>example.org/about.html</loc>
<loc>example.org/research.html</loc>
<lastmod>2024-02-23</lastmod>
</url>
</urlset>

0 comments on commit c152bf8

Please sign in to comment.