简体   繁体   English

HTML 页面 - 所有 HTML 页面中的顶部菜单(页眉)和页脚是否相同?

[英]HTML Page - same top menu (header) and footer in all HTML pages?

I am developing a static website (don't need any server-side support. I have Basic HTML and JAVAscript) which have a number of pages.我正在开发一个包含多个页面的静态网站(不需要任何服务器端支持。我有基本的 HTML 和 JAVAscript)。

all pages have the same top menu (header) and footer.所有页面都有相同的顶部菜单(页眉)和页脚。 what is the best practice considering SEO ?考虑SEO的最佳做法是什么?

I have two options:我有两个选择:

Option 1. Should I copy header.html & footr.html code on every HTML page?选项 1。我应该在每个 HTML 页面上复制 header.html 和 footr.html 代码吗?

Option 2. Should I include header.html & footer.html on every HTML page?选项 2。我应该在每个 HTML 页面上包含 header.html 和 footer.html 吗?

which Option is better?哪个选项更好? Does any of them affect SEO?它们中的任何一个都会影响 SEO 吗?

if Option 2 is the right solution then my follow up question is "How to include common header.html and footer.html?"如果选项 2 是正确的解决方案,那么我的后续问题是“How to include common header.html and footer.html?” I don't want to use PHP/ iframe.我不想使用 PHP/iframe。

For easy client end work, I could have suggested jquery or javascript for client end rendering of header and footer, but you are looking for SEO friendly web pages.为了方便客户端工作,我可以建议使用 jquery 或 javascript 进行页眉和页脚的客户端呈现,但您正在寻找 SEO 友好的网页。

Considering SEO you need to have rendered HTML pages with header and footer so crawlers can read it (and above solution won't work for that as it renders extra stuff after page load).考虑到 SEO,您需要呈现带有页眉和页脚的 HTML 页面,以便爬虫可以读取它(上面的解决方案不适用于此,因为它会在页面加载后呈现额外的内容)。 So either you go for copying and pasting header footer to each page or use PHP/.NET etc for server end rendering that will handle header and footer while rendering.因此,您要么将页眉页脚复制并粘贴到每个页面,要么使用 PHP/.NET 等进行服务器端渲染,以便在渲染时处理页眉和页脚。

How often do you change the content of the header?您多久更改一次标头的内容? When I was starting with web design I used to include the whole menu with/copy paste, and then do search/replace across all files.当我开始进行网页设计时,我曾经使用/复制粘贴来包含整个菜单,然后在所有文件中进行搜索/替换。 But this was before PHP and JS were around.但这是在 PHP 和 JS 出现之前。

Content-wise, it should be the same.内容方面,应该是一样的。 There could be a difference in the number of HTTP requests and load time if you are including something from another file.如果您包含来自另一个文件的内容,HTTP 请求的数量和加载时间可能会有所不同。

These are so small speed differences that I don't think that it will make any difference SEO-wise.这些速度差异是如此之小,以至于我认为它不会对 SEO 产生任何影响。

I personally like to use PHP to include content but you have said that this is not an option for you.我个人喜欢使用 PHP 来包含内容,但您说过这不适合您。 Depending on whether you want to use jquery, pure JS, or some other way there is a bunch of different approaches .根据您是想使用 jquery、纯 JS 还是其他一些方式,有很多不同的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM