Coder Social home page Coder Social logo

blog-engine's Introduction

博客引擎

这个引擎可以随意修改

master分支更新慢,但是稳定,develop更新快,可能有bug

用这行代码克隆这个仓库

git clone https://github.com/WP-Studio01/blog-engine.git

windows和linux都可以运行

接下来,这些地方可以修改

/src/index.js

 4
import App from './App';

let title='Blog'; //可以修改,页面标题
document.title=title;
const root = ReactDOM.createRoot(document.getElementById('root'));

/src/components/body/body.jsx

 6
let repos='blogdata';
let user='WP-Studio01';

这两个都可以改,第一个是存储issue的存储库名称,第二个是存储库的主人用户名

 34
if(hash=='#/home')
{
    element=<Home />;
}
else if(hash=="#/blog")
{
    element=<Bloglist repos={repos} user={user} showother />;
}
else if(/^#\/blog\/\d+$/.test(hash))
{
    let id=hash.split('/').at(-1);
    element=<Blog id={id} repos={repos} user={user} />
}
else
{
    window.location.hash='#/home';
}

这些地方都可以改,如果要新增页面就新增一个逻辑就可以了,顺便说一句,页面使用Ajax动态更新,不用url只用锚记

 38
else if(hash=="#/blog")
{
    element=<Bloglist repos={repos} user={user} showother />;
}

这里如果允许别人发帖就加上showother,显示已关闭帖子就加上showclose

就像这样

else if(hash=="#/blog")
{
    element=<Bloglist repos={repos} user={user} showother showclose />;
}

/src/App.jsx

 4
function App() {
  return (
    <>
      <Nav title={['Home','Blogs']} hrefs={['#/home','#/blog']} /> //这里可以改
      <Body />
    </>
  );
}

title数组为导航栏中的显示文字

hrefs数组为导航栏指向的链接

如果这里改了那么页面逻辑那里也要新增逻辑

blog-engine's People

Contributors

wp-studio01 avatar

Watchers

 avatar

blog-engine's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.