<p>So I simplified a website using templates, setup a github.io site. Just curious if I can host my golang site on github or if I need my own server to run main.go(main.exe)?</p>
<hr/>**评论:**<br/><br/>justinisrael: <pre><p>I might be wrong, but as far as I know, github pages only serve static content. I currently use it to host my own site. It uses Hugo to generate static content. </p></pre>GoArray: <pre><p>Looks like you're spot on, thanks!</p></pre>tv64738: <pre><p>I generate static files with Go templates and use Github Pages to serve them. Why would Github care (/be able to know) how the file content was generated?</p></pre>GoArray: <pre><p>I'll have to look into this. I'm only up to having {{template header}} in index.html and {{define header}} in header.html. I thought go was required to link them?</p></pre>tv64738: <pre><p>So use Go to create the HTML you need. Github Pages only cares about the resulting file, not how you created it.</p></pre>GoArray: <pre><p>I must be missing something, or mis-explaining? Or just not understanding.. lol </p>
<p>So here's my index.html: </p>
<hr/>
<p><!DOCTYPE HTML><br/>
<html> </p>
<p>{{template "header"}} </p>
<p><body><br/>
<div id="main"><br/>
<div id="header"><br/>
{{template "logo"}} {{template "navbar"}}<br/>
</div><br/>
<div id="content_header"></div><br/>
<div id="site_content"><br/>
<div id="banner"></div><br/>
<div id="sidebar_container"><br/>
{{template "sbfavs"}} {{template "sblinks"}} {{template "sbsmed"}}<br/>
</div><br/>
<div id="content"><br/>
{{template "dindex"}}<br/>
</div><br/>
</div><br/>
{{template "footer"}}<br/>
</div><br/>
</body> </p>
<p></html> </p>
<hr/>
<p>So, it's a *.html, but it won't display properly because main.go is needed to execute the template placeholders. I kind of thought you were saying I could output my template format into standard html, but no?</p></pre>tv64738: <pre><p>Naming a file *.pptx doesn't make it a PowerPoint presentation.</p>
<p>Run a Go program that executes the template.</p></pre>
Likely a silly question, but is there anyway to host and run my template based website on github pages?
agolangf · · 448 次点击这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传